/// <summary> /// Gets the language based on the browser UserLanguages and the given market. /// </summary> /// <param name="request">The request.</param> /// <param name="market">The market.</param> /// <returns></returns> public CultureInfo GetLanguage(HttpRequestBase request, IMarket market) { if (request == null) { throw new System.ArgumentNullException(nameof(request)); } if (market == null) { throw new System.ArgumentNullException(nameof(market)); } var language = _geolocationService.GetBrowserLanguages(request) .Select(x => market.Languages.FirstOrDefault(l => l.Name.Equals(x))) .FirstOrDefault(x => x != null); return(language); }