public void DeleteItems() { if (_customersToDelete == null || _customersToDelete.Count <= 0) { var reason = _customersToDelete == null ? "null" : "equal or less than zero"; var message = string.Format("Deletion could not be executed " + "because to the internal list being {0}", reason); throw new PetsEntityException(message); } try { using (PetShopDBContext _dbContext = new PetShopDBContext()) { //_dbContext.Customers.RemoveRange(_customersToDelete); _dbContext.TagEntitiesAsDeleted <Customer>(_customersToDelete); _dbContext.SaveChanges(); _customersToDelete.Clear(); } } catch (Exception exception) { // logging here throw; } }