Added beforeDelete hook