private void Deliver(SendGridMessage message)
 {
     IApplicationSettingsService applicationSettings = new ApplicationSettingsService(_userName);
     var username = applicationSettings.GetEmailServiceUsername();
     var password = applicationSettings.GetEmailServiceKeyCode();
     var credentials = new NetworkCredential(username, password);
     var transportWeb = new Web(credentials);
     transportWeb.DeliverAsync(message);
 }
 public static SendEmailTemplate GetSendEmailType(IRepository<Email> emailRepository, string userName)
 {
     IApplicationSettingsService applicationSettings = new ApplicationSettingsService(userName);
     switch (applicationSettings.GetEmailServiceOnlineType())
     {
         case EnumHelper.EmailServiceTypes.Offline:
             return new SendEmailOffline(emailRepository);
         case EnumHelper.EmailServiceTypes.OnlineSendGrid:
             return new SendEmailSendGrid(emailRepository, userName);
         default:
             return new SendEmailOffline(emailRepository);
     }
 }