call beforeDelete and afterDelete