public async Task SendAsync(string recipient, INotificationTemplateData templateData) { if (templateData == null) { throw new ArgumentNullException(nameof(templateData)); } MailAddress recipientMailAddress; try { recipientMailAddress = new MailAddress(recipient); } catch (FormatException e) { throw new ArgumentException($"Incorrect format for passed recipient email: `{recipient}`.", e); } var notification = await _notificationTemplateService.CreateNotification(templateData); // Send the email via gateway client await _emailClientProvider.SendAsync(recipientMailAddress, notification.Subject, notification.Body); }