Throwing necessary exception in delete method