private async Task <string> UploadToRealCloudAsync(MediaFile file)
        {
            var mediaStream = file.GetStream();

            string filename = Path.GetFileNameWithoutExtension(AlbumPath);

            // Get the SAS token from the backend
            var storageToken = await CloudService.GetUpSasTokenAsync(Settings.CurrentSharingSpace, filename);

            // Use the SAS token to upload the file
            var storageUri  = new Uri($"{storageToken.Uri}{storageToken.SasToken}");
            var blobStorage = new CloudBlockBlob(storageUri);

            // Compress
            byte[] img;
            using (var fileStream = System.IO.File.OpenRead(AlbumPath))
            {
                using (BinaryReader br = new BinaryReader(fileStream))
                {
                    img = br.ReadBytes((int)fileStream.Length);
                }
            }

            // Resize image (do not forget to add the iOS version of it)
            byte[] resizedImageArray = ImageResizer.ResizeImageAndroid(img, 720, 486);
            Stream resizedImage      = new MemoryStream(resizedImageArray);

            await blobStorage.UploadFromStreamAsync(resizedImage);

            // Set the content type of the current blob to image/jpeg
            blobStorage.Properties.ContentType = "image/jpeg";
            await blobStorage.SetPropertiesAsync();

            return(storageToken.Uri.ToString());
        }
        private void SaveBitmap()
        {
            if (this.rotatedBitmap == null)
            {
                return;
            }

            if (!this.isChanged)
            {
                return;
            }

            MemoryStream stream = new MemoryStream();

            this.rotatedBitmap.Compress(Bitmap.CompressFormat.Png, 100, stream);
            ArticleDetailsActivity.imageLarge = stream.ToArray();


            byte[] resizedImage = ImageResizer.ResizeImageAndroid(this.rotatedBitmap, 48 * 2, 85 * 2);

            Bitmap smallBitmap = BitmapFactory.DecodeByteArray(resizedImage, 0, resizedImage.Length);

            stream = new MemoryStream();
            smallBitmap.Compress(Bitmap.CompressFormat.Png, 100, stream);
            ArticleDetailsActivity.imageSmall = stream.ToArray();

            Intent intent = new Intent();

            this.SetResult(Result.Ok, intent);

            this.rotatedBitmap = null;
            this.isChanged     = false;
        }
        //public ICommand ItemTappedCommand
        //{
        //    get
        //    {
        //        return new Command( () =>
        //        {
        //            Debug.WriteLine("I am being tapped!!");

        //        });
        //    }
        //}

        private async Task <string> UploadToCloud(string filename)
        {
            // Parse the connection string and return a reference to the storage account.
            // Retrieve storage account from connection string.
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Constants.StorageConnection);

            // Create the blob client.
            CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();

            // Retrieve a reference to a container.
            CloudBlobContainer container = blobClient.GetContainerReference(Settings.UserId.Replace("|", ""));
            // Create the container if it doesn't already exist.
            await container.CreateIfNotExistsAsync();

            // Set permissions for public access
            await container.SetPermissionsAsync(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Blob });

            // Get the user directory within the container
            var directory = container.GetDirectoryReference(Settings.CurrentSharingSpace);
            // Retrieve reference to a blob named "myblob".
            CloudBlockBlob blockBlob = directory.GetBlockBlobReference(filename);

            byte[] img;
            using (var fileStream = System.IO.File.OpenRead(AlbumPath))
            {
                using (BinaryReader br = new BinaryReader(fileStream))
                {
                    img = br.ReadBytes((int)fileStream.Length);
                }
            }

            // Resize image (do not forget to add the iOS version of it)
            byte[] resizedImageArray = ImageResizer.ResizeImageAndroid(img, 720, 486);
            Stream resizedImage      = new MemoryStream(resizedImageArray);
            await blockBlob.UploadFromStreamAsync(resizedImage);

            // Create or overwrite the "xxxx" blob with contents from a local file.
            //using (var fileStream = System.IO.File.OpenRead(AlbumPath))
            //{
            //    await blockBlob.UploadFromStreamAsync(fileStream);
            //}

            // Set the content type of the current blob to image/jpeg
            blockBlob.Properties.ContentType = "image/jpeg";
            await blockBlob.SetPropertiesAsync();

            return(blockBlob.Uri.ToString());
        }