update model attributes in creation and deleting