changes in model add hooks before save and before delete

changes in model add hooks before save and before delete