Added check for duplicate publicid