public Boolean SetConfig(string _serviceName, string _queryKey, string _primaryLanguage)
        {
            this.searchServiceName = _serviceName;
            this.queryApiKey       = _queryKey;
            List <IndexName> indexList = GetIndexListFromAzure();

            if (indexList.Count > 0)
            {
                UsersConfigMapSection config = UsersConfigMapSection.Config;
                if (config != null)
                {
                    List <UsersConfigMapConfigElement> languages = config.SettingsList.ToList <UsersConfigMapConfigElement>();
                    if (languages != null)
                    {
                        try
                        {
                            SetUltimateIndex(indexList, languages);
                            SetParentIndex(indexList, languages, _primaryLanguage);
                            SetPrimaryIndex(indexList, languages, _primaryLanguage);
                        }
                        catch (InvalidConfigurationException)
                        {
                            return(false);
                        }
                    }
                }
            }
            return(primaryIndexClient != null || parentIndexClient != null || ultimateIndexClient != null);
        }
        public static string GetParentLanguage(string primaryLanguage)
        {
            UsersConfigMapSection config = UsersConfigMapSection.Config;

            if (config != null)
            {
                List <UsersConfigMapConfigElement> languages             = config.SettingsList.ToList <UsersConfigMapConfigElement>();
                UsersConfigMapConfigElement        primaryLanguageConfig = languages.Where(l => l.PrimaryLanguage.ToLower() == primaryLanguage.ToLower()).FirstOrDefault();
                if (primaryLanguageConfig != null)
                {
                    if (!string.IsNullOrEmpty(primaryLanguageConfig.ParentLanguage) && !string.IsNullOrEmpty(primaryLanguageConfig.ParentIndex))
                    {
                        //Invalid config. @parentlanguage and @parentindex cannot both be set for @language.
                        return(string.Empty);
                    }
                    if (!string.IsNullOrEmpty(primaryLanguageConfig.ParentLanguage))
                    {
                        try
                        {
                            return(GetAncestorWithParentIndexLanguage(languages, primaryLanguageConfig.ParentLanguage));
                        }
                        catch (InvalidConfigurationException)
                        {
                            return(string.Empty);
                        }
                    }
                }
            }
            return(string.Empty);
        }
        public static string GetUltimateLanguage()
        {
            UsersConfigMapSection config = UsersConfigMapSection.Config;

            if (config != null)
            {
                List <UsersConfigMapConfigElement> languages = config.SettingsList.ToList <UsersConfigMapConfigElement>();
                UsersConfigMapConfigElement        ultimateLanguageConfig = languages.Where(l => l.UltimateIndex != string.Empty).FirstOrDefault();
                if (ultimateLanguageConfig != null)
                {
                    return(ultimateLanguageConfig.PrimaryLanguage);
                }
            }
            return(string.Empty);
        }