public static void SendAutomationEmailToAllUsersWithExpiringOfInsurance(FilterService filterService, MailService mailService) { List <string> emailsForInsurance = filterService.GetMailsForCarsInsuranceExpirationToday().ToList(); mailService.SendEmail(ApplicationConstants.SubjectExpiringInsurance, ApplicationConstants.ContentExpiringInsurance, emailsForInsurance); List <Car> cars = filterService.FilterExpiringInsuranceToday().ToList(); foreach (var car in cars) { car.IsEmailSendedForInsurance = true; } filterService.SaveChanges(); Console.WriteLine(ApplicationConstants.SuccessOfAutomationSendingOnEmailsForInsurance); }