private Task GenerateDocument(Document document)
 {
     try
     {
         var documentGenerator = new DocumentGenerator(this, document);
         return documentGenerator.Generate();
     }
     catch (Exception e)
     {
         Log.Exception(e, "Document generation failed for: " + (document.FilePath ?? document.ToString()));
         return Task.FromResult(e);
     }
 }