public async Task <IFileDescriptor> GetBlobMetaDataAsync(string fileId)
        {
            //string fileId = fileRef.Value;
            var containerClient = await GetBlobContainerAsync();

            BlobClient blobClient = containerClient.GetBlobClient(fileId);

            if (await blobClient.ExistsAsync())
            {
                BlobProperties properties = await blobClient.GetPropertiesAsync();

                var fileName = properties.Metadata[FileNameMetaDataAttribut];
                return(new FileDescriptor()
                {
                    Id = fileId,
                    FileName = fileName,
                    ContentType = properties.ContentType,
                    Size = properties.ContentLength
                });
            }
            else
            {
                throw new Exception("Blob doesn't exist");
            }
        }
        public async Task <BlobDownloadInfo?> GetFileStreamAsync(string fileId)
        {
            var containerClient = await GetBlobContainerAsync();

            BlobClient blobClient = containerClient.GetBlobClient(fileId);

            if (await blobClient.ExistsAsync())
            {
                return(await blobClient.DownloadAsync());
            }
            else
            {
                return(null);
            }
        }
        public async Task <Stream?> GetThumbnailStreamAsync(string fileId, bool fill, int?x, int?y)
        {
            var key             = string.Format("{0}{1}_{2}_{3}", fileId, fill ? "_fill" : "", x, y);
            var containerClient = await GetBlobContainerAsync();

            BlobClient blobClient = containerClient.GetBlobClient(key);

            if (!await blobClient.ExistsAsync())
            {
                var sourceDownloadInfo = await GetFileStreamAsync(fileId);

                if (sourceDownloadInfo == null) // source not found
                {
                    throw new ArgumentException(string.Format("FileId: {0} not found", fileId));
                }
                // create new thumbnail and persist it
                var thumbBitmap = BlobStorageUtils.BuildThumbnailBitmap(sourceDownloadInfo, fill, x, y);
                if (thumbBitmap != null)
                {
                    MemoryStream memoryStream = new MemoryStream();
                    thumbBitmap.Save(memoryStream, ImageFormat.Jpeg);
                    await AddFileFromStream(memoryStream, memoryStream.Length, key, blobClient.Name);

                    memoryStream.Seek(0, SeekOrigin.Begin);
                    return(memoryStream);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                // thumbnail already exists
                var downloadedBlob = await blobClient.DownloadAsync();

                return(downloadedBlob.Value.Content);
            }
        }