private static void Download(IntPtr directoryItem, uint size, IntPtr stream)
 {
     if (stream == IntPtr.Zero)
     {
         return;
     }
     try
     {
         Util.Assert(Edsdk.EdsDownload(directoryItem, size, stream), "Failed to download to stream");
         Util.Assert(Edsdk.EdsDownloadComplete(directoryItem), "Failed to complete download");
     }
     catch (EosException)
     {
         throw;
     }
     catch (Exception ex)
     {
         throw new EosException(-1, "Unexpected exception while downloading.", ex);
     }
 }