/// <summary>
 /// Update the state of all jobs in a job collections.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Update Jobs State operation.
 /// </param>
 /// <returns>
 /// The Update Jobs State operation response.
 /// </returns>
 public static JobCollectionJobsUpdateStateResponse UpdateJobCollectionState(this IJobOperations operations, PatchJobCollectionJobsUpdateStateParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IJobOperations)s).UpdateJobCollectionStateAsync(parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// Update the state of all jobs in a job collections.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Update Jobs State operation.
 /// </param>
 /// <returns>
 /// The Update Jobs State operation response.
 /// </returns>
 public static Task<JobCollectionJobsUpdateStateResponse> UpdateJobCollectionStateAsync(this IJobOperations operations, PatchJobCollectionJobsUpdateStateParameters parameters)
 {
     return operations.UpdateJobCollectionStateAsync(parameters, CancellationToken.None);
 }
 /// <summary>
 /// Update the state of all jobs in a job collections.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Update Jobs State operation.
 /// </param>
 /// <returns>
 /// The Update Jobs State operation response.
 /// </returns>
 public static JobCollectionJobsUpdateStateResponse UpdateJobCollectionState(this IJobOperations operations, PatchJobCollectionJobsUpdateStateParameters parameters)
 {
     try
     {
         return operations.UpdateJobCollectionStateAsync(parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }