/// <summary>
 /// Returns a new <see cref="IAsset"/> with the files in <paramref name="folderPath"/>.
 /// </summary>
 /// <param name="assets">The <see cref="AssetBaseCollection"/> instance.</param>
 /// <param name="folderPath">The path to the folder with the files to upload to the new <see cref="IAsset"/>.</param>
 /// <param name="storageAccountName">The name of the storage account where to store the new <see cref="IAsset"/>.</param>
 /// <param name="options">The <see cref="AssetCreationOptions"/>.</param>
 /// <param name="uploadProgressChangedCallback">A callback to report upload progress of the files.</param>
 /// <returns>A new <see cref="IAsset"/> with the files in <paramref name="folderPath"/>.</returns>
 public static IAsset CreateFromFolder(this AssetBaseCollection assets, string folderPath, string storageAccountName, AssetCreationOptions options, Action<IAssetFile, UploadProgressChangedEventArgs> uploadProgressChangedCallback)
 {
     using (Task<IAsset> task = assets.CreateFromFolderAsync(folderPath, storageAccountName, options, uploadProgressChangedCallback, CancellationToken.None))
     {
         return task.Result;
     }
 }
 /// <summary>
 /// Returns a <see cref="System.Threading.Tasks.Task&lt;IAsset&gt;"/> instance for a new <see cref="IAsset"/> with the files in <paramref name="folderPath"/>.
 /// </summary>
 /// <param name="assets">The <see cref="AssetBaseCollection"/> instance.</param>
 /// <param name="folderPath">The path to the folder with the files to upload to the new <see cref="IAsset"/>.</param>
 /// <param name="options">The <see cref="AssetCreationOptions"/>.</param>
 /// <param name="uploadProgressChangedCallback">A callback to report upload progress of the files.</param>
 /// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/> instance used for cancellation.</param>
 /// <returns>A <see cref="System.Threading.Tasks.Task&lt;IAsset&gt;"/> instance for a new <see cref="IAsset"/> with the files in <paramref name="folderPath"/>.</returns>
 public static Task<IAsset> CreateFromFolderAsync(this AssetBaseCollection assets, string folderPath, AssetCreationOptions options, Action<IAssetFile, UploadProgressChangedEventArgs> uploadProgressChangedCallback, CancellationToken cancellationToken)
 {
     return assets.CreateFromFolderAsync(folderPath, (string)null, options, uploadProgressChangedCallback, cancellationToken);
 }
 /// <summary>
 /// Returns a <see cref="System.Threading.Tasks.Task&lt;IAsset&gt;"/> instance for the new <see cref="IAsset"/>.
 /// </summary>
 /// <param name="assets">The <see cref="AssetBaseCollection"/> instance.</param>
 /// <param name="folderPath">The path to the folder with the files to upload to the new <see cref="IAsset"/>.</param>
 /// <param name="options">The <see cref="AssetCreationOptions"/>.</param>
 /// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/> instance used for cancellation.</param>
 /// <returns>A <see cref="System.Threading.Tasks.Task&lt;IAsset&gt;"/> instance for new <see cref="IAsset"/>.</returns>
 public static Task<IAsset> CreateFromFolderAsync(this AssetBaseCollection assets, string folderPath, AssetCreationOptions options, CancellationToken cancellationToken)
 {
     return assets.CreateFromFolderAsync(folderPath, options, null, cancellationToken);
 }
        /// <summary>
        /// Returns a <see cref="System.Threading.Tasks.Task&lt;IAsset&gt;"/> instance for a new <see cref="IAsset"/> with the files in <paramref name="folderPath"/>.
        /// </summary>
        /// <param name="assets">The <see cref="AssetBaseCollection"/> instance.</param>
        /// <param name="folderPath">The path to the folder with the files to upload to the new <see cref="IAsset"/>.</param>
        /// <param name="strategy">The <see cref="IAccountSelectionStrategy"/> used to select a storage account for the new asset.</param>
        /// <param name="options">The <see cref="AssetCreationOptions"/>.</param>
        /// <param name="uploadProgressChangedCallback">A callback to report upload progress of the files.</param>
        /// <param name="cancellationToken">The <see cref="System.Threading.CancellationToken"/> instance used for cancellation.</param>
        /// <returns>A <see cref="System.Threading.Tasks.Task&lt;IAsset&gt;"/> instance for a new <see cref="IAsset"/> with the files in <paramref name="folderPath"/>.</returns>
        public static Task<IAsset> CreateFromFolderAsync(this AssetBaseCollection assets, string folderPath, IAccountSelectionStrategy strategy, AssetCreationOptions options, Action<IAssetFile, UploadProgressChangedEventArgs> uploadProgressChangedCallback, CancellationToken cancellationToken)
        {
            if (assets == null)
            {
                throw new ArgumentNullException("assets");
            }

            if (strategy == null)
            {
                throw new ArgumentNullException("strategy");
            }

            string storageAccountName = strategy.SelectAccountForAsset();

            return assets.CreateFromFolderAsync(folderPath, storageAccountName, options, uploadProgressChangedCallback, cancellationToken);
        }