private bool deQueue(out LoggingEventModel loggingEvent)
        {
            lock (_lockObject)
            {
                if (_queue.Count > 0)
                {
                    loggingEvent = _queue.Dequeue();
                    return true;
                }

                loggingEvent = null;
                return false;
            }
        }
        private LoggingEventModel createLoggingEventModel(LoggingEvent loggingEvent)
        {
            var loggingEventModel = new LoggingEventModel
            {
                user = string.IsNullOrWhiteSpace(loggingEvent.Identity) ? null : loggingEvent.Identity,
                logger = loggingEvent.LoggerName,
                level = loggingEvent.Level.Name.ToLower(),
                message = loggingEvent.RenderedMessage,
                time_stamp = loggingEvent.TimeStamp.ToUniversalTime().ToString("u")
            };

            // Grab stack trace
            if (null != loggingEvent.ExceptionObject && !string.IsNullOrWhiteSpace(loggingEvent.ExceptionObject.StackTrace))
                loggingEventModel.stack_trace = loggingEvent.ExceptionObject.StackTrace;

            // Attach additional http request data when available
            if (null != HttpContext.Current)
            {
                var context = HttpContext.Current;

                // For fatal and error attach headers and any form data
                var headers = new List<dynamic>();
                var formParams = new List<dynamic>();

                if (_logHttpForLevels.Contains(loggingEvent.Level.Name.ToLower()))
                {
                    foreach (var headerKey in context.Request.Headers.AllKeys)
                    {
                        var value = context.Request.Headers[headerKey];
                        if (!string.IsNullOrWhiteSpace(value))
                            headers.Add(new { key = headerKey, value });
                    }

                    if (context.Request.Form.Keys.Count > 0)
                    {
                        foreach (var key in context.Request.Form.AllKeys)
                        {
                            var value = context.Request.Form[key];
                            if (!string.IsNullOrWhiteSpace(value))
                                formParams.Add(new { key, value = context.Request.Form[key] });
                        }
                    }
                }

                loggingEventModel.http = new
                {
                    session_id = null != context.Session ? context.Session.SessionID : null,
                    current_user = string.IsNullOrWhiteSpace(context.User.Identity.Name) ? null : context.User.Identity.Name,
                    http_method = context.Request.HttpMethod,
                    url = context.Request.Url,
                    url_referrer = context.Request.UrlReferrer,
                    user_agent = context.Request.UserAgent,
                    user_host_address = context.Request.UserHostAddress,
                    user_host_name = context.Request.UserHostName,
                    authentication_type = string.IsNullOrWhiteSpace(context.User.Identity.AuthenticationType) ? null : context.User.Identity.AuthenticationType,
                    request_headers = headers.Count > 0 ? headers : null,
                    form_params = formParams.Count > 0 ? formParams : null
                };
            }

            return loggingEventModel;
        }