added a function to ease the writing of model function checking the existence of a row in the database