/// <summary>
        /// A private method that is used by both GetTermDictionary by id and Name.
        /// </summary>
        /// <param name="byType">The  value that specifies the type of search to be performed.</param>
        /// <param name="language">This is English or Spanish</param>
        /// <param name="termId">The CDRID of the term</param>
        /// <param name="termName">The term name</param>
        /// <param name="audience">This Patient or HealthProfessional</param>
        /// <returns>TermDictionaryServiceItem instance</returns>
        private TermDictionaryServiceItem getTermDictionary(TermDefinitionByType byType, string language, int termId, string termName, string audience)
        {
            TermDictionaryServiceItem termDicSvcItem = null;

            try
            {
                // language passed to an enum calling this also validates the language value passed is meaningful DisplayLanguage
                DisplayLanguage displayLanguage =
                    (DisplayLanguage)Enum.Parse(typeof(DisplayLanguage), language);

                // Call the database query
                TermDictionaryDataItem termDicDataItem = null;

                if (byType == TermDefinitionByType.ById)
                {
                    termDicDataItem = TermDictionaryManager.GetDefinitionByTermID(language, termId.ToString(), audience, 1);
                }
                else
                {
                    termDicDataItem = TermDictionaryManager.GetDefinitionByTermName(displayLanguage, termName, audience, 1);
                }

                if (termDicDataItem != null)
                {
                    termDicSvcItem = createTermDictionarySvcItem(termDicDataItem);
                }
            }
            catch (Exception ex)
            {
                // Log the error that occured
                CancerGovError.LogError("TermDictionary", 2, ex);
            }

            return(termDicSvcItem);
        }
        private TermDictionaryServiceItem createTermDictionarySvcItem(TermDictionaryDataItem termDictItem)
        {
            TermDictionaryServiceItem termDictionaryServiceItem = new TermDictionaryServiceItem(termDictItem.GlossaryTermID, termDictItem.TermName, null);

            termDictionaryServiceItem.TermDictionaryDetail = termDictItem;
            return(termDictionaryServiceItem);
        }