/// <summary>
        /// Emit a batch of log events, running to completion synchronously.
        /// </summary>
        /// <param name="events">The events to emit.</param>
        /// <remarks>Override either <see cref="PeriodicBatchingSink.EmitBatch"/> or <see cref="PeriodicBatchingSink.EmitBatchAsync"/>,
        /// not both.</remarks>
        protected override void EmitBatch(IEnumerable<LogEvent> events)
        {
            var operation = new TableBatchOperation();
            
            var first = true;
            
            foreach (var logEvent in events)
            {
                if (first)
                {
                    //check to make sure the partition key is not the same as the previous batch
                    if (partitionKey != logEvent.Timestamp.Ticks)
                    {
                        batchRowId = 0; //the partitionkey has been reset
                        partitionKey = logEvent.Timestamp.Ticks; //store the new partition key
                    }
                    first = false;
                }

                var logEventEntity = new LogEventEntity(logEvent, _formatProvider, partitionKey);
                logEventEntity.RowKey += "|" + batchRowId;
                operation.Add(TableOperation.Insert(logEventEntity));

                batchRowId++;
            }
            _table.ExecuteBatch(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,
         logEvent.Timestamp.ToUniversalTime().Ticks);
     EnsureUniqueRowKey(logEventEntity);
     _table.Execute(TableOperation.Insert(logEventEntity));
 }