public async Task SendNotificationsAsync(string orgName) { var userOrg = await _organizationService.GetOrganizationByNameAsync(orgName); var typesToNotifyAbout = (await _eventUtilitiesService.GetEventTypesToRemindAsync(userOrg.Id)).ToList(); var typeIdsToNotifyAbout = typesToNotifyAbout.Select(e => e.Id).ToList(); if (!typesToNotifyAbout.Any()) { return; } var anythingToJoin = await _eventUtilitiesService.AnyEventsThisWeekByTypeAsync(typeIdsToNotifyAbout); if (!anythingToJoin) { return; } var usersToNotifyInApp = (await _userEventsService.GetUsersWithAppRemindersAsync(typeIdsToNotifyAbout)).ToList(); var usersToNotifyEmail = (await _userEventsService.GetUsersWithEmailRemindersAsync(typeIdsToNotifyAbout)).ToList(); if (usersToNotifyInApp.Any()) { await _notificationService.CreateForEventJoinReminderAsync(usersToNotifyInApp, userOrg.Id); } if (usersToNotifyEmail.Any()) { await _eventNotificationService.RemindUsersToJoinEventAsync(typesToNotifyAbout, usersToNotifyEmail, userOrg.Id); } }