protected override async Task EmitBatchAsync(IEnumerable <LogEvent> events)
        {
            var    operation        = new TableBatchOperation();
            string lastPartitionKey = null;

            foreach (var logEvent in events)
            {
                var partitionKey = _keyGenerator.GeneratePartitionKey(logEvent);
                if (partitionKey != lastPartitionKey)
                {
                    lastPartitionKey = partitionKey;
                    if (operation.Count > 0)
                    {
                        await _table.ExecuteBatchAsync(operation);

                        operation = new TableBatchOperation();
                    }
                }
                var logEventEntity = new LogEventEntity(logEvent, _formatProvider, partitionKey, _keyGenerator.GenerateRowKey(logEvent));
                operation.Add(TableOperation.Insert(logEventEntity));
            }
            if (operation.Count > 0)
            {
                await _table.ExecuteBatchAsync(operation);
            }
        }
        /// <summary>
        ///     Emit the provided log event to the sink.
        /// </summary>
        /// <param name="logEvent">The log event to write.</param>
        public void Emit(LogEvent logEvent)
        {
            var logEventEntity = new LogEventEntity(logEvent, _formatProvider,
                                                    _keyGenerator.GeneratePartitionKey(logEvent),
                                                    _keyGenerator.GenerateRowKey(logEvent)
                                                    );

            _table.ExecuteAsync(TableOperation.Insert(logEventEntity)).SyncContextSafeWait(_waitTimeoutMilliseconds);
        }