/// <summary>
        /// Text in taxon title.
        /// </summary>
        /// <param name="taxonTitle">The taxon title.</param>
        /// <param name="textToFind">Text to locate.</param>
        /// <param name="type">Compare type.</param>
        /// <param name="compareType">Type of the compare.</param>
        /// <returns>
        /// true if it succeeds, false if it fails.
        /// </returns>
        private static bool TextInTaxonTitle(string taxonTitle, string textToFind, HierarchicalTaxonCompareType type, StringComparison compareType)
        {
            switch (type)
            {
            case HierarchicalTaxonCompareType.StartsWith:
                return(taxonTitle.StartsWith(textToFind, compareType));

            case HierarchicalTaxonCompareType.EndsWith:
                return(taxonTitle.EndsWith(textToFind, compareType));

            case HierarchicalTaxonCompareType.Contains:
                return(taxonTitle.Contains(textToFind));

            case HierarchicalTaxonCompareType.Equals:
                return(taxonTitle.Equals(textToFind, compareType));

            default:
                return(false);
            }
        }
        /// <summary>
        /// Searches from Parent to parent to match the taxon name you need, returns the first match
        /// ** Sitefinitysteve.com Extension **.
        /// </summary>
        /// <param name="currentTaxon">Current Node.</param>
        /// <param name="textToFind">Text to locate.</param>
        /// <param name="type">Compare type.</param>
        /// <param name="isCaseSensitive">Case Sensitive check, doesn't apply to Contains.</param>
        /// <returns>
        /// Null if nothing found.
        /// </returns>
        public static HierarchicalTaxon GetFirstParentTaxon(this HierarchicalTaxon currentTaxon, string textToFind, HierarchicalTaxonCompareType type, bool isCaseSensitive)
        {
            StringComparison compareType = (isCaseSensitive) ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

            while (currentTaxon != null)
            {
                if (TextInTaxonTitle(currentTaxon.Title, textToFind, type, compareType))
                {
                    return(currentTaxon);
                }
                currentTaxon = currentTaxon.Parent;
            }

            return(null);
        }
        /// <summary>
        /// Searches from Parent to parent to match the taxon name you need, returns the first match
        /// ** Sitefinitysteve.com Extension **
        /// </summary>
        /// <param name="currentTaxon">Current Node</param>
        /// <param name="textToFind">Text to locate</param>
        /// <param name="type">Compare type</param>
        /// <param name="isCaseSensitive">Case Sensitive check, doesn't apply to Contains</param>
        /// <returns>Null if nothing found</returns>
        public static HierarchicalTaxon GetFirstParentTaxon(this HierarchicalTaxon currentTaxon, string textToFind, HierarchicalTaxonCompareType type, bool isCaseSensitive)
        {
            bool found = false;
            HierarchicalTaxon foundTaxon = null;
            var compareType = (isCaseSensitive) ? StringComparison.CurrentCulture : StringComparison.CurrentCultureIgnoreCase;

            //Check this one, TODO: consolidate this and the one below
            if (type == HierarchicalTaxonCompareType.StartsWith)
            {
                found = currentTaxon.Title.StartsWith(textToFind, compareType);
            }
            else if (type == HierarchicalTaxonCompareType.EndsWith)
            {
                found = currentTaxon.Title.EndsWith(textToFind, compareType);
            }
            else if (type == HierarchicalTaxonCompareType.Equals)
            {
                found = currentTaxon.Title.Equals(textToFind, compareType);
            }
            else if (type == HierarchicalTaxonCompareType.Contains)
            {
                found = currentTaxon.Title.Contains(textToFind);
            }

            if (found)
            {
                return(currentTaxon);
            }


            if (currentTaxon.Parent != null)
            {
                while (currentTaxon != null)
                {
                    switch (type)
                    {
                    case HierarchicalTaxonCompareType.StartsWith:
                        found = currentTaxon.Title.StartsWith(textToFind, compareType);
                        break;

                    case HierarchicalTaxonCompareType.EndsWith:
                        found = currentTaxon.Title.EndsWith(textToFind, compareType);
                        break;

                    case HierarchicalTaxonCompareType.Contains:
                        found = currentTaxon.Title.Contains(textToFind);
                        break;

                    case HierarchicalTaxonCompareType.Equals:
                        found = currentTaxon.Title.Equals(textToFind, compareType);
                        break;
                    }

                    if (found)
                    {
                        foundTaxon = currentTaxon;
                        break;
                    }
                    else
                    {
                        currentTaxon = currentTaxon.Parent;
                    }
                }
            }

            return(foundTaxon);
        }