public async Task Run() { var nextWeeklyNotificationDates = dateCalculator.GetNextWeeklyNotificationDates(); var requests = await requestRepository.GetRequests( nextWeeklyNotificationDates.First().PlusDays(-60), nextWeeklyNotificationDates.Last()); var users = await userRepository.GetUsers(); foreach (var user in users.Where(u => UserIsActive(u, requests) && !HasUpcomingRequests(u, requests, nextWeeklyNotificationDates) && u.RequestReminderEnabled)) { await this.emailRepository.Send( new EmailTemplates.RequestReminder(user, nextWeeklyNotificationDates)); } }