/// <summary>
        /// Credential autocomplete
        /// Needs to check authorization level for credential
        /// </summary>
        /// <param name="keyword"></param>
        /// <param name="maxTerms"></param>
        /// <returns></returns>
        public static List <object> Autocomplete(string keywords, int maxTerms = 25)
        {
            int userId = 0;

            string where = " base.EntityStateId = 3 ";
            string  AND        = "";
            int     pTotalRows = 0;
            AppUser user       = AccountServices.GetCurrentUser();

            if (user != null && user.Id > 0)
            {
                userId = user.Id;
            }

            if (UtilityManager.GetAppKeyValue("usingElasticCredentialAutocomplete", false))
            {
                return(ElasticHelper.CredentialAutoComplete(keywords, maxTerms, ref pTotalRows));
            }
            else
            {
                bool usingLinqAutocomplete = true;
                if (usingLinqAutocomplete)
                {
                    return(CredentialManager.AutocompleteInternal(keywords, 1, maxTerms, ref pTotalRows));
                }
                else
                {
                    string text = " (base.name like '{0}'  OR base.AlternateName like '{0}' OR OwningOrganization like '{0}'  ) ";
                    //SetKeywordFilter( keywords, true, ref where );
                    keywords = ServiceHelper.HandleApostrophes(keywords);
                    if (keywords.IndexOf("%") == -1)
                    {
                        keywords = SearchServices.SearchifyWord(keywords);
                    }
                    if (where.Length > 0)
                    {
                        AND = " AND ";
                    }
                    where = where + AND + string.Format(" ( " + text + " ) ", keywords);

                    return(CredentialManager.AutocompleteDB(where, 1, maxTerms, ref pTotalRows));
                }
                // return new List<string>();
            }
        }