Check for duplicate product ID - defines a new function checkDuplicate