call before and afterDelete