/// <summary>
 /// Get the execution history of a Job.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='jobId'>
 /// Required. Id of the job to get the history of.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Job History operation.
 /// </param>
 /// <returns>
 /// The Get Job History operation response.
 /// </returns>
 public static JobGetHistoryResponse GetHistory(this IJobOperations operations, string jobId, JobGetHistoryParameters parameters)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IJobOperations)s).GetHistoryAsync(jobId, parameters);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
 /// <summary>
 /// Get the execution history of a Job.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='jobId'>
 /// Required. Id of the job to get the history of.
 /// </param>
 /// <param name='parameters'>
 /// Required. Parameters supplied to the Get Job History operation.
 /// </param>
 /// <returns>
 /// The Get Job History operation response.
 /// </returns>
 public static Task<JobGetHistoryResponse> GetHistoryAsync(this IJobOperations operations, string jobId, JobGetHistoryParameters parameters)
 {
     return operations.GetHistoryAsync(jobId, parameters, CancellationToken.None);
 }
 /// <summary>
 /// Get the execution history of a Job.
 /// </summary>
 /// <param name='operations'>
 /// Reference to the Microsoft.WindowsAzure.Scheduler.IJobOperations.
 /// </param>
 /// <param name='jobId'>
 /// Id of the job to get the history of.
 /// </param>
 /// <param name='parameters'>
 /// Parameters supplied to the Get Job History operation.
 /// </param>
 /// <returns>
 /// The Get Job History operation response.
 /// </returns>
 public static JobGetHistoryResponse GetHistory(this IJobOperations operations, string jobId, JobGetHistoryParameters parameters)
 {
     try
     {
         return operations.GetHistoryAsync(jobId, parameters).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }