Did you try invoking the referenceInsert function inside of your if statement?
if (item.userReference === 0) {
referenceInsert();
}
Did you try invoking the referenceInsert function inside of your if statement?
if (item.userReference === 0) {
referenceInsert();
}