private HttpClient InitializeClient()
        {
            var handler = new HttpClientHandler();
            var client  = new HttpClient(handler)
            {
                BaseAddress = new Uri(DiagnosticServiceEndpoint),
                Timeout     = TimeSpan.FromSeconds(5 * 60),
                MaxResponseContentBufferSize = int.MaxValue
            };

            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            client.DefaultRequestHeaders.Add("User-Agent", "AppLens");

            if ((environment.IsProduction() || environment.IsStaging()) && !environment.IsEnvironment("NationalCloud"))
            {
                LoadCert();
                byte[] certContent = Cert.Export(X509ContentType.Cert);
                client.DefaultRequestHeaders.Add("x-ms-diagcert", Convert.ToBase64String(certContent));
            }

            return(client);
        }