public static async void DownloadFromCloud(ICollection <AutomationAsset> assetsToDownload, String localWorkspacePath, AutomationManagementClient automationApi, string resourceGroupName, string automationAccountName, String encryptionCertThumbprint, ICollection <ConnectionType> connectionTypes)
        {
            try
            {
                var cloudAssets = await AutomationAssetManager.GetAll(null, automationApi, resourceGroupName, automationAccountName, encryptionCertThumbprint, connectionTypes);

                var assetsToSaveLocally = new SortedSet <AutomationAsset>();

                foreach (var cloudAsset in cloudAssets)
                {
                    foreach (var assetToDownload in assetsToDownload)
                    {
                        if (cloudAsset.Equals(assetToDownload))
                        {
                            assetsToSaveLocally.Add(cloudAsset);
                            break;
                        }
                    }
                }

                AutomationAssetManager.SaveLocally(localWorkspacePath, assetsToSaveLocally, encryptionCertThumbprint, connectionTypes);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public static async void DownloadFromCloud(ICollection <AutomationAsset> assetsToDownload, String localWorkspacePath, AutomationManagementClient automationApi, string resourceGroupName, string automationAccountName, String encryptionCertThumbprint)
        {
            var cloudAssets = await AutomationAssetManager.GetAll(null, automationApi, resourceGroupName, automationAccountName, encryptionCertThumbprint);

            var assetsToSaveLocally = new SortedSet <AutomationAsset>();

            foreach (var cloudAsset in cloudAssets)
            {
                foreach (var assetToDownload in assetsToDownload)
                {
                    if (cloudAsset.Equals(assetToDownload))
                    {
                        assetsToSaveLocally.Add(cloudAsset);
                        break;
                    }
                }
            }

            AutomationAssetManager.SaveLocally(localWorkspacePath, assetsToSaveLocally, encryptionCertThumbprint);
        }
        public static async Task DownloadAllFromCloud(String localWorkspacePath, AutomationManagementClient automationApi, string resourceGroupName, string automationAccountName, String encryptionCertThumbprint, ICollection <ConnectionType> connectionTypes)
        {
            var assets = await AutomationAssetManager.GetAll(null, automationApi, resourceGroupName, automationAccountName, encryptionCertThumbprint, connectionTypes);

            AutomationAssetManager.SaveLocally(localWorkspacePath, assets, encryptionCertThumbprint, connectionTypes);
        }