public Stream GetContent(FileInfoContract source, ProgressProxy progress)
        {
            var result = gateway.GetContent(rootName, source.Id);

            if (!result.CanSeek) {
                var bufferStream = new MemoryStream();
                result.CopyTo(bufferStream, MAX_BULKDOWNLOAD_SIZE);
                bufferStream.Seek(0, SeekOrigin.Begin);
                result.Dispose();
                result = bufferStream;
            }

            result = new ProgressStream(result, progress);

            if (!string.IsNullOrEmpty(encryptionKey))
                result = result.Decrypt(encryptionKey);

            return result;
        }
        public Stream GetContent(FileInfoContract source, ProgressProxy progress)
        {
            try {
                var result = gateway.GetContentAsync(rootName, source.Id).Result;

                if (!result.CanSeek) {
                    var bufferStream = new MemoryStream();
                    result.CopyTo(bufferStream, MAX_BULKDOWNLOAD_SIZE);
                    bufferStream.Seek(0, SeekOrigin.Begin);
                    result.Dispose();
                    result = bufferStream;
                }

                result = new ProgressStream(result, progress);

                if (!string.IsNullOrEmpty(encryptionKey))
                    result = result.Decrypt(encryptionKey);

                return result;
            } catch (AggregateException ex) when (ex.InnerExceptions.Count == 1) {
                throw ex.InnerExceptions[0];
            }
        }