public void ArchiveAllActiveFoodItemsFromProvider(int providerId) { var entitiesToRemove = RepositoryDbSet .Where(item => item.ProviderId == providerId) .Where(item => item.DateStart.Day == DateTime.Now.Day) .ToList(); foreach (var foodItem in entitiesToRemove) { foodItem.DateEnd = DateTime.Now; } RepositoryDbSet.UpdateRange(entitiesToRemove); }