/// <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>
 /// Gets the value compatibly.
 /// </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="cookieActions">The cookie actions.</param>
 /// <param name="key">The key.</param>
 /// <returns></returns>
 private static string GetValueCompatibly <TRequest, TResponse>(HttpContextContainer <TRequest, TResponse> context, IHttpRequestCookieActions cookieActions, string key)
 {
     return(!string.IsNullOrWhiteSpace(key) ? (context?.TryGetRequestHeader(key).SafeToString(cookieActions?.GetCookieValue(key))) : null);
 }