getNextId and verifyExist