/// <summary>
        /// Main method
        /// Checks if terminal ifood if yes then send requests to ifood servers and Rewrite the response and halts.
        /// </summary>
        public static void ExecuteProxy()
        {
            try
            {
                var gprsRequest = new GprsRequest(HttpContext.Current.Request);
                if (IsTerminalIdIfood(gprsRequest))
                {
                    LoggingHelper.Debug(Logger, "Request is iFood : " + gprsRequest);

                    var webResponse = MakeProxyRequest(gprsRequest);

                    FinalizeCurrentRequest(webResponse);
                }
                else
                {
                    LoggingHelper.Debug(Logger, "Request is not iFood : " + gprsRequest);
                }
            }
            catch (Exception ex)
            {
                Logger.Error("Cannot execute proxy. " + ex.Message + ex.StackTrace);
            }
        }
 /// <summary>
 /// Generates request to ifood servers
 /// </summary>
 /// <param name="gprsRequest"></param>
 /// <returns></returns>
 private static HttpWebResponse MakeProxyRequest(GprsRequest gprsRequest)
 {
     HttpWebRequest request = (HttpWebRequest) WebRequest.Create(RewriteUrl(gprsRequest.Url));
     request.UserAgent = "Talabat Proxy";
     var webResponse = (HttpWebResponse) request.GetResponse();
     return webResponse;
 }
 /// <summary>
 /// Checks if request is done by ifood device
 /// </summary>
 /// <param name="request"></param>
 /// <returns></returns>
 private static bool IsTerminalIdIfood(GprsRequest request)
 {
     if (null == request || request.TerminalId <= 0)
     {
         return false;
     }
     return iFoodGprsDeviceRepository.CheckIsIfood(request.TerminalId);
 }