private void RunDownloadHandler(DownloadHandlerRunModel runModel)
 {
     KeePassPasswordProvider.RegisterPassword(runModel.KeePassPassword.ConvertToSecureString());
     if (KeePassService.CheckPassword())
     {
         foreach (var handlerKey in runModel.DownloadHandlerKeys)
         {
             try
             {
                 using (var downloadHandler = Container.ResolveKeyed <IBankDownloadHandler>(handlerKey))
                 {
                     downloadHandler.Execute(true, runModel.DownloadStatements);
                 }
             }
             catch (BalanceCheckException ex)
             {
                 //this is just a failed check balance
                 Logger.LogWarning(ex,
                                   $"Failed balance check for {handlerKey} expected {ex.Expected} actual {ex.Actual}. Be aware of pending transactions which might influence the expected balance. Especially when importing during nighttime.");
             }
             catch (Exception ex)
             {
                 Logger.LogError(ex, $"Unexpected exception occured for {handlerKey}");
             }
         }
     }
     else
     {
         Logger.LogInformation("Invalid password");
     }
     KeePassPasswordProvider.DeregisterPassword();
 }
 public IActionResult Run([FromBody] DownloadHandlerRunModel runModel)
 {
     RunDownloadHandler(runModel);
     //TODO add signalR for posting back status updates
     return(Json(Guid.NewGuid()));
 }