async Task ExecuteActions(
     NuGetProject project,
     IEnumerable <NuGetProjectAction> actions,
     ConsoleHostNuGetPackageManager packageManager,
     SourceCacheContext cacheContext)
 {
     if (actions.Any())
     {
         if (WhatIf.IsPresent)
         {
             // For -WhatIf, only preview the actions
             PreviewNuGetPackageActions(actions);
         }
         else
         {
             // Execute project actions by Package Manager
             await packageManager.ExecuteNuGetProjectActionsAsync(
                 project,
                 actions,
                 this,
                 cacheContext,
                 ConsoleHost.Token);
         }
     }
     else
     {
         Log(MessageLevel.Info,
             GettextCatalog.GetString("No package updates are available from the current package source for project '{0}'.",
                                      project.GetMetadata <string> (NuGetProjectMetadataKeys.Name)));
     }
 }
        protected async Task UninstallPackageByIdAsync(
            NuGetProject project,
            string packageId,
            UninstallationContext uninstallContext,
            INuGetProjectContext projectContext,
            bool isPreview)
        {
            ConsoleHostNuGetPackageManager   packageManager = ConsoleHost.CreatePackageManager();
            IEnumerable <NuGetProjectAction> actions        = await packageManager.PreviewUninstallPackageAsync(project, packageId, uninstallContext, projectContext, ConsoleHost.Token);

            if (isPreview)
            {
                PreviewNuGetPackageActions(actions);
            }
            else
            {
                await packageManager.ExecuteNuGetProjectActionsAsync(project, actions, projectContext, ConsoleHost.Token);
            }
        }