/// <summary>
 /// Creates a new queue. Once created, this queue’s resource manifest
 /// is immutable. This operation is idempotent. Repeating the create
 /// call, after a queue with same name has been created successfully,
 /// will result in a 409 Conflict error message.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj856295.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations.
 /// </param>
 /// <returns>
 /// A response to a request for a particular queue.
 /// </returns>
 public static ServiceBusQueueResponse Create(this IQueueOperations operations, string namespaceName, ServiceBusQueue queue)
 {
     try
     {
         return operations.CreateAsync(namespaceName, queue).Result;
     }
     catch (AggregateException ex)
     {
         if (ex.InnerExceptions.Count > 1)
         {
             throw;
         }
         else
         {
             throw ex.InnerException;
         }
     }
 }
 /// <summary>
 /// Updates the queue description and makes a call to update
 /// corresponding DB entries.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj856305.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='queue'>
 /// Required. The service bus queue.
 /// </param>
 /// <returns>
 /// A response to a request for a particular queue.
 /// </returns>
 public static Task<ServiceBusQueueResponse> UpdateAsync(this IQueueOperations operations, string namespaceName, ServiceBusQueue queue)
 {
     return operations.UpdateAsync(namespaceName, queue, CancellationToken.None);
 }
 /// <summary>
 /// Updates the queue description and makes a call to update
 /// corresponding DB entries.  (see
 /// http://msdn.microsoft.com/en-us/library/windowsazure/jj856305.aspx
 /// for more information)
 /// </summary>
 /// <param name='operations'>
 /// Reference to the
 /// Microsoft.WindowsAzure.Management.ServiceBus.IQueueOperations.
 /// </param>
 /// <param name='namespaceName'>
 /// Required. The namespace name.
 /// </param>
 /// <param name='queue'>
 /// Required. The service bus queue.
 /// </param>
 /// <returns>
 /// A response to a request for a particular queue.
 /// </returns>
 public static ServiceBusQueueResponse Update(this IQueueOperations operations, string namespaceName, ServiceBusQueue queue)
 {
     return Task.Factory.StartNew((object s) => 
     {
         return ((IQueueOperations)s).UpdateAsync(namespaceName, queue);
     }
     , operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }