Check if a record is existed or not before saving