public static async Task AddMessageAndCreateIfNotExistsAsync(this IStorageQueue queue,
            IStorageQueueMessage message, CancellationToken cancellationToken)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            bool isQueueNotFoundException = false;

            try
            {
                await queue.AddMessageAsync(message, cancellationToken);
                return;
            }
            catch (StorageException exception)
            {
                if (!exception.IsNotFoundQueueNotFound())
                {
                    throw;
                }

                isQueueNotFoundException = true;
            }

            Debug.Assert(isQueueNotFoundException);
            await queue.CreateIfNotExistsAsync(cancellationToken);
            await queue.AddMessageAsync(message, cancellationToken);
        }
        public static void CreateIfNotExists(this IStorageBlobContainer container)
        {
            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            container.CreateIfNotExistsAsync(CancellationToken.None).GetAwaiter().GetResult();
        }
        public static void CreateIfNotExists(this IStorageQueue queue)
        {
            if (queue == null)
            {
                throw new ArgumentNullException("queue");
            }

            queue.CreateIfNotExistsAsync(CancellationToken.None).GetAwaiter().GetResult();
        }
 /// <summary>
 ///     Creates the table if it does not already exist.
 /// </summary>
 /// <returns>
 ///     <c>true</c> if table was created; otherwise, <c>false</c>.
 /// </returns>
 public static bool CreateIfNotExists(this CloudTable table)
 {
     return table.CreateIfNotExistsAsync().ExecuteSynchronously();
 }