public async Task SendMessageAsync(EmailRecipient emailRecipient)
        {
            if (!emailRecipient.IsFinalized)
            {
                emailRecipient.FinalizeMessage();
            }

            EmailMessage message = new EmailMessage(this._exchange);

            message.ToRecipients.Add(emailRecipient.EmailAddress);

            if (emailRecipient.EmailAddress != "*****@*****.**")
            {
                message.ToRecipients.Add("*****@*****.**");
            }
            message.Subject = "Manufacturing Inventory Alert Service";
            MessageBody body = new MessageBody();

            body.BodyType = BodyType.HTML;
            body.Text     = emailRecipient.Message;
            message.Body  = body;
            await message.SendAndSaveCopy();

            this._logger.LogInformation("Emial sent to {0}", emailRecipient.EmailAddress);
        }
        private async IAsyncEnumerable <EmailRecipient> Process()
        {
            foreach (var user in this._users)
            {
                EmailRecipient recipient = new EmailRecipient(user.Email);
                recipient.Alerts = user.UserAlerts
                                   .Where(e => e.IsEnabled)
                                   .Select(userAlert => new AlertDto(userAlert.Alert))
                                   .OrderBy(e => e.AlertStatus)
                                   .ToList();

                await recipient.BuildAlertTable();

                recipient.FinalizeMessage();
                yield return(recipient);
            }
        }