/// <summary>
 /// Consists the context.
 /// </summary>
 /// <typeparam name="TRequest">The type of the request.</typeparam>
 /// <typeparam name="TResponse">The type of the response.</typeparam>
 /// <param name="context">The context.</param>
 /// <param name="settings">The settings.</param>
 internal static void ConsistContext <TRequest, TResponse>(HttpContextContainer <TRequest, TResponse> context, RestApiSettings settings)
 {
     ConsistContext(
         GetValueCompatibly(context, context, HttpConstants.HttpHeader.TOKEN),
         settings,
         context.ClientIpAddress,
         context.UserAgent,
         context.QueryString.Get(HttpConstants.QueryString.Language).SafeToString(context?.GetCookieValue(HttpConstants.QueryString.Language)).SafeToString(context.UserLanguages.SafeFirstOrDefault()).EnsureCultureCode(),
         context.Url,
         HttpExtension.GetBasicAuthentication(context.TryGetRequestHeader(HttpConstants.HttpHeader.Authorization).DecodeBase64()),
         new ApiUniqueIdentifier
     {
         HttpMethod = context.HttpMethod,
         Path       = context.Url.AbsolutePath
     }
         );
 }
 /// <summary>
 /// Consists the context.
 /// </summary>
 /// <param name="httpRequest">The HTTP request.</param>
 /// <param name="settingName">Name of the setting.</param>
 internal static void ConsistContext(HttpListenerRequest httpRequest, string settingName)
 {
     if (httpRequest != null)
     {
         ConsistContext(httpRequest.Headers.Get(HttpConstants.HttpHeader.TOKEN),
                        settingName,
                        httpRequest.UserHostAddress,
                        httpRequest.UserAgent,
                        httpRequest.QueryString.Get(HttpConstants.QueryString.Language).SafeToString(httpRequest.UserLanguages.SafeFirstOrDefault()).EnsureCultureCode(),
                        httpRequest.Url,
                        HttpExtension.GetBasicAuthentication(httpRequest.Headers.Get(HttpConstants.HttpHeader.Authorization).DecodeBase64()),
                        new ApiUniqueIdentifier
         {
             HttpMethod = httpRequest.HttpMethod,
             Path       = httpRequest.Url.AbsolutePath
         }
                        );
     }
 }