private async Task SendRequest(BugSenseError er)
        {
            HttpClient client = new HttpClient();
            switch (_mode)
            {
                case ReportMode.Normal:
                    client.BaseAddress = new Uri(NormalAddress, UriKind.Absolute);
                    break;
                case ReportMode.Secure:
                    client.BaseAddress = new Uri(SecureAddress, UriKind.Absolute);
                    break;
                default:
                    throw new Exception("Ajjaj, nagy gaz van.");
            }
            client.DefaultRequestHeaders.ExpectContinue = false;
            client.DefaultRequestHeaders.Add(ApiKeyHttpHeader, _apiKey);

            StringContent content = new StringContent("data=" + Uri.EscapeDataString(GetJson(er)), Encoding.UTF8, "application/x-www-form-urlencoded");

            HttpResponseMessage response = null;

            try
            {
                response = await client.PostAsync(RequestUri, content);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("## Error in the error reporting process :)\n## Message: {0}", ex.Message);
            }
        }
        private string GetJson(BugSenseError er)
        {
            DataContractJsonSerializer s = new DataContractJsonSerializer(typeof(BugSenseError));

            string json = null;
            using (var stream = new MemoryStream())
            {

                try
                {
                    s.WriteObject(stream, er);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
                byte[] payload = stream.ToArray();
                json = Encoding.UTF8.GetString(payload, 0, payload.Length);
            }
            System.Diagnostics.Debug.WriteLine(json);
            return json;
        }
        public void LogError(Exception ex, Dictionary<string, string> customData)
        {
            if (!_initialized)
            {
                throw new InvalidOperationException("BugSenseHandler must be initialized first!");
            }

            BugSenseError error = new BugSenseError();
            error.Client = _client;
            error.Request = new BugSenseRequest(NetworkHelper.CurrentIPAddress(), customData);
            error.Exception = new BugSenseException(ex);
            error.Environment = _appEnv;

            SendRequest(error);
        }