public void DeleteMessagingPreferencesByCustomer(Guid userId, string customerNumber, string branchId) { //this also works for user default since customer = null for user default var messagingPreferences = _userMessagingPreferenceRepository.Read(i => (i.UserId.Equals(userId) && i.CustomerNumber.Equals(customerNumber) && i.BranchId.Equals(branchId, StringComparison.InvariantCultureIgnoreCase))); foreach (var pref in messagingPreferences) { _userMessagingPreferenceRepository.Delete(pref); } _uow.SaveChanges(); }