ORM validate and last insert id