That's not needed since duplicate entries are not created by that code, but the following is an improvement:
if (event.value) {
event.target.insertItemAt(event.value);
} else {
event.rc = false;
}
so that the user can't blank the field and get the resulting error.