public void SendScopeChangeEmails(Organisation organisation, DateTime reportingYear, DateTime currentSnapshotDate, ScopeStatuses newScope) { // Send emails if scope changed on current or previous reporting year if (reportingYear == currentSnapshotDate || reportingYear == currentSnapshotDate.AddYears(-1)) { // Find all email addresses associated with the organisation - only the active ones (who have confirmed their PIN) IEnumerable <string> emailAddressesForOrganisation = organisation.UserOrganisations .Where(uo => uo.PINConfirmedDate.HasValue) .Select(uo => uo.User.EmailAddress); // Send email of correct type to each email address associated with organisation foreach (string emailAddress in emailAddressesForOrganisation) { if (newScope == ScopeStatuses.InScope) { // Use Notify to send in scope email emailSendingService.SendScopeChangeInEmail(emailAddress, organisation.OrganisationName); } else { // Use Notify to send out of scope email emailSendingService.SendScopeChangeOutEmail(emailAddress, organisation.OrganisationName); } } } }