public void EndRequest(HttpContextBase contextBase)
        {
            _moduleStopwatch.Start();

            SizeCalculations(_capture.Length);

            try
            {
                string response = contextBase.Response.Filter.ToString();

                contextBase.Response.Clear();

                RequestAnalysis.AssemblyCount = AppDomain.CurrentDomain.GetAssemblies().Length;

                _endStrings = RequestAnalysisUtils.GetStringCount();
                RequestAnalysis.StringsCount = _endStrings - _startStrings;

                _endMemory = GC.GetTotalMemory(true);
                RequestAnalysis.MemoryUsage = _endMemory - _startMemory;

                _moduleStopwatch.Stop();
                _totalStopwatch.Stop();

                RequestAnalysis.TotalRequestTime  = _totalStopwatch.Elapsed;
                RequestAnalysis.ModuleRequestTime = _moduleStopwatch.Elapsed;

                RequestAnalysisUtils.WriteToLog(RequestAnalysis, _requestsLogger);

                NameValueCollection appSettings = SharedUtils.GetConfigSection("appSettings");
                string featureToggle_Interface  = appSettings["FeatureToggle_Interface"];
                bool.TryParse(featureToggle_Interface, out bool enabled);

                // Building the stats and writing the response will take some time but it can't be displayed to the user
                response = response.Replace("</body>", RequestAnalysisUtils.BuildStatsOutput(RequestAnalysis, enabled));

                contextBase.Response.Write(response);
            }
            catch (Exception ex)
            {
                SharedUtils.Log("RequestId " + RequestAnalysis.RequestId + "Exception " + ex, _logger);
            }
        }