/// <summary>
 /// You can create a server farm by issuing an HTTP POST request. Only
 /// one server farm per webspace is permitted. You can retrieve server
 /// farm details by using HTTP GET, change server farm properties by
 /// using HTTP PUT, and delete a server farm by using HTTP DELETE. A
 /// request body is required for server farm creation (HTTP POST) and
 /// server farm update (HTTP PUT).  Warning: Creating a server farm
 /// changes your webspace’s Compute Mode from Shared to Dedicated. You
 /// will be charged from the moment the server farm is created, even
 /// if all your sites are still running in Free mode.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn194277.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IServerFarmOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// The name of the web space.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Update Server Farm operation.
 /// </param>
 /// <returns>
 /// The Update Server Farm operation response.
 /// </returns>
 public static ServerFarmUpdateResponse Update(this IServerFarmOperations operations, string webSpaceName, ServerFarmUpdateParameters parameters)
 {
     try
     {
         return operations.UpdateAsync(webSpaceName, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <summary>
 /// You can create a server farm by issuing an HTTP POST request. Only
 /// one server farm per webspace is permitted. You can retrieve server
 /// farm details by using HTTP GET, change server farm properties by
 /// using HTTP PUT, and delete a server farm by using HTTP DELETE. A
 /// request body is required for server farm creation (HTTP POST) and
 /// server farm update (HTTP PUT).  Warning: Creating a server farm
 /// changes your webspace’s Compute Mode from Shared to Dedicated. You
 /// will be charged from the moment the server farm is created, even
 /// if all your sites are still running in Free mode.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn194277.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IServerFarmOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// The name of the web space.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Update Server Farm operation.
 /// </param>
 /// <returns>
 /// The Update Server Farm operation response.
 /// </returns>
 public static Task<ServerFarmUpdateResponse> UpdateAsync(this IServerFarmOperations operations, string webSpaceName, ServerFarmUpdateParameters parameters)
 {
     return operations.UpdateAsync(webSpaceName, parameters, CancellationToken.None);
 }
 /// <summary>
 /// You can create a server farm by issuing an HTTP POST request. Only
 /// one server farm per webspace is permitted. You can retrieve server
 /// farm details by using HTTP GET, change server farm properties by
 /// using HTTP PUT, and delete a server farm by using HTTP DELETE. A
 /// request body is required for server farm creation (HTTP POST) and
 /// server farm update (HTTP PUT). Warning: Creating a server farm
 /// changes your webspace's Compute Mode from Shared to Dedicated. You
 /// will be charged from the moment the server farm is created, even
 /// if all your sites are still running in Free mode.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/dn194277.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.WebSites.IServerFarmOperations.
 /// </param>
 /// <param name='webSpaceName'>
 /// Required. The name of the web space.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Update Server Farm operation.
 /// </param>
 /// <returns>
 /// The Update Server Farm operation response.
 /// </returns>
 public static ServerFarmUpdateResponse Update(this IServerFarmOperations operations, string webSpaceName, ServerFarmUpdateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IServerFarmOperations)s).UpdateAsync(webSpaceName, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }