/// <summary>
        /// Writes an array of logging events to the log target. By default it iterates on all
        /// events and passes them to "Write" method. Inheriting classes can use this method to
        /// optimize batch writes.
        /// </summary>
        /// <param name="logEvents">Logging events to be written out.</param>
        protected async override void Write(IList <AsyncLogEventInfo> logEvents)
        {
            //must sort into containers and then into the blobs for the container
            if (_getTableNameDelegate == null)
            {
                _getTableNameDelegate = c => TableName.Render(c.LogEvent);
            }

            var tableBuckets = SortHelpers.BucketSort(logEvents, _getTableNameDelegate);

            //Iterate over all the tables being written to
            foreach (var tableBucket in tableBuckets)
            {
                var tableNameFinal = CheckAndRepairTableNamingRules(tableBucket.Key);
                InitializeTable(tableNameFinal);
                var batch = new TableBatchOperation();
                //add each message for the destination table limit batch to 100 elements
                foreach (var asyncLogEventInfo in tableBucket.Value)
                {
                    var entity = new NLogEntity(asyncLogEventInfo.LogEvent, Layout);
                    batch.Insert(entity);
                    if (batch.Count == 100)
                    {
                        await _table.ExecuteBatchAsync(batch);

                        batch.Clear();
                    }
                }
                if (batch.Count > 0)
                {
                    await _table.ExecuteBatchAsync(batch);
                }
            }
        }
        /// <summary>
        /// Writes logging event to the log target.
        /// classes.
        /// </summary>
        /// <param name="logEvent">Logging event to be written out.</param>
        protected async override void Write(LogEventInfo logEvent)
        {
            if (String.IsNullOrEmpty(logEvent.Message))
            {
                return;
            }

            var tempTableName  = TableName.Render(logEvent);
            var tableNameFinal = CheckAndRepairTableNamingRules(tempTableName);
            var logMessage     = string.Concat(Layout.Render(logEvent), Environment.NewLine);

            InitializeTable(tableNameFinal);
            var entity          = new NLogEntity(logEvent, Layout);
            var insertOperation = TableOperation.Insert(entity);
            await _table.ExecuteAsync(insertOperation);
        }