Refactored deleting entities