test beforeSave and afterSave hook