private bool ProcessQueue(IEnumerable <Log> logs, bool IsAlreadyMapped)
        {
            if (logs != null && logs.Count() > 0)
            {
                Batch batch = new Batch();
                batch.ApplicationName    = logAgent.Configuration.ApplicationName;
                batch.ApplicationVersion = logAgent.Configuration.ApplicationVersion;
                batch.ApplicationId      = logAgent.Configuration.ApplicationId;
                batch.SessionId          = logAgent.SessionId;
                batch.InstanceId         = InstanceDataClient.InstanceId;
                batch.BatchId            = Guid.NewGuid();
                batch.TimeStamp          = logAgent.ServerTimeOffset.HasValue ? DateTimeOffset.Now.Add(logAgent.ServerTimeOffset.Value).Ticks : DateTimeOffset.Now.Ticks;

                batch.TotalFailures = FailedSendCount;
                batch.LogsDropped   = logAgent.TotalLogsDropped;
                batch.LogsSent      = logAgent.TotalLogsSent;
                batch.Logs          = logs;

                Batch mappedBatch;
                if (!IsAlreadyMapped)
                {
                    // apply mappings. If mappings are defined, it will create new instance of the batch and the logs using different keys and dropping come elements.
                    mappedBatch = logAgent.MapBatchAndLogs(batch);
                }
                else
                {
                    // apply mappings but ONLY to the batch. The logs have already been mapped.
                    mappedBatch = logAgent.MapBatch(batch);
                }

                try
                {
                    if (BatchSending != null)
                    {
                        BatchSending(this, new BatchEventArgs(mappedBatch));
                    }
                }
                catch { /* swollow */ }

                SendCount++;

                // the data client does the work of actually sending the info to the server
                return(dataClient.LogBatchAsync(mappedBatch));
            }
            else
            {
                return(false);
            }
        }