private static void Wrapper(Action worker, ErrorContainer errors)
 {
     try
     {
         worker();
     }
     catch (Exception e)
     {
         if (!errors.HasErrors)
         {
             // Internal error - something was thrown without adding to the error container.
             // Add at least one error
             errors.InternalError(e);
         }
     }
 }
 // Wrapper to ensure consistent invariants between loading a document, exception handling, and returning errors. 
 private static CanvasDocument Wrapper(Func<CanvasDocument> worker, ErrorContainer errors)
 {
     CanvasDocument document = null;
     try
     {
         document = worker();
         if (errors.HasErrors)
         {
             return null;
         }
         return document;
     }
     catch (Exception e)
     {
         if (!errors.HasErrors)
         {
             // Internal error - something was thrown without adding to the error container.
             // Add at least one error
             errors.InternalError(e);
         }
         return null;
     }
 }