changed to beforeSave()