beforeInsert and BeforeUpdate