/// <summary>
        /// Gets the underlying taxa.
        /// </summary>
        /// <param name="parentTaxon">The parent taxon.</param>
        /// <returns>List of taxa that have red list category factor.</returns>
        public TaxonList GetUnderlyingTaxa(ITaxon parentTaxon)
        {
            TaxonList taxonList = parentTaxon.GetChildTaxonTree(mUserContext, true).GetChildTaxa();

            taxonList.Insert(0, parentTaxon);

            return(taxonList);
        }
        ///// <summary>
        ///// Get current search result taxa From Session.
        ///// </summary>
        ///// <returns>List of taxon information or null.</returns>
        //public List<TaxonListInformation> GetSelectedTaxaListModelFromSession()
        //{
        //    if (SessionHandler.CurrentSelectedTaxa.IsNotNull())
        //    {
        //        return SessionHandler.CurrentSelectedTaxa;
        //    }

        //    return null;
        //}

        ///// <summary>
        ///// Get current selected taxa From Session.
        ///// </summary>
        ///// <returns>List of taxon information or null.</returns>
        //public List<TaxonListInformation> GetViewModelSelectedTaxaListModelFromSession()
        //{
        //    if (SessionHandler.CurrentViewModelSelectedTaxa.IsNotNull())
        //    {
        //        return SessionHandler.CurrentViewModelSelectedTaxa;
        //    }

        //    return null;
        //}

        ///// <summary>
        ///// Gets the namesearch string
        ///// </summary>
        ///// <returns></returns>
        //public string GetCurrentFilterSearchStringFromSession()
        //{
        //    return SessionHandler.FilterSearchString;
        //}

        ///// <summary>
        ///// Sets the filtersearch string
        ///// </summary>
        ///// <param name="filterSearchString"></param>
        //public void SetCurrentFilterSearchStringInSession(string filterSearchString)
        //{
        //    SessionHandler.FilterSearchString = filterSearchString;
        //}

        ///// <summary>
        ///// Sets the viewmodel from the latest namesearch
        ///// </summary>
        ///// <param name="model"></param>
        //public void SetNameSearchViewModelInSession(List<TaxonSearchResultItemViewModel> model)
        //{
        //    SessionHandler.TaxonSearchViewModel = model;
        //}

        //public List<TaxonSearchResultItemViewModel> GetNameSearchViewModelFromSession()
        //{
        //    return SessionHandler.TaxonSearchViewModel;
        //}

        ///// <summary>
        ///// Gets the resultviewtype from the session
        ///// </summary>
        ///// <returns></returns>
        //public ResultViewType GetResultViewTypeFromSession()
        //{
        //    return SessionHandler.ResultViewType;
        //}

        ///// <summary>
        ///// Sets the resultviewtype in the session
        ///// </summary>
        //public void SetResultViewTypeInSession(ResultViewType resultViewType)
        //{
        //    SessionHandler.ResultViewType = resultViewType;
        //}

        ///// <summary>
        ///// Gets the underlying taxa. Checks for redlist occurence and swedish occurrence.
        ///// The parent taxon is also included if it have red list category factor. Only taxa with categories below and
        ///// equal to species are returned.
        ///// </summary>
        ///// <param name="parentTaxonId">The parent taxon identifier.</param>
        ///// <returns>List of <see cref="TaxonListInformation"/> that have red list category factor.</returns>
        //public List<TaxonListInformation> GetUnderlyingTaxaFromScope(int parentTaxonId)
        //{
        //    TaxonList childTaxa = GetUnderlyingTaxa(parentTaxonId);
        //    var taxonIdList = new TaxonIdList();

        //    // Select all valid taxa ids (from "artfakta db")
        //    HashSet<int> taxonIdsSet = GetAllValidTaxaIds();
        //    childTaxa.RemoveAll(y => !taxonIdsSet.Contains(y.Id));

        //    foreach (ITaxon taxon in childTaxa)
        //    {
        //        taxonIdList.Add(new TaxonIdImplementation(taxon.Id));
        //    }

        //    List<TaxonListInformation> taxonListInformations = TaxonListInformationManager.Instance.GetTaxonListInformation(taxonIdList, false, null);

        //    // Remove data if only redlisted is to be shown
        //    if (SessionHandler.UseOnlyRedlistedData)
        //    {
        //        // Remove other taxa then from result depending on data selection LC/NE/NA taxa could be included or excluded.
        //        RemoveTaxaNotRedlistedOrRedlistedEnsuredFromList(taxonListInformations);
        //    }

        //    // Check for SwedishOccurrence
        //    if (SessionHandler.UseSwedishOccurrence)
        //    {
        //        taxonListInformations = taxonListInformations.Where(x => x.SwedishOccurrenceId > AppSettings.Default.SwedishOccurrenceExist).ToList();
        //    }

        //    return taxonListInformations;
        //}

        /// <summary>
        /// Gets the underlying taxa.
        /// </summary>
        /// <param name="parentTaxonId">The parent taxon identifier.</param>
        /// <returns>List of taxa that have red list category factor.</returns>
        public TaxonList GetUnderlyingTaxa(int parentTaxonId)
        {
            ITaxon    parentTaxon = CoreData.TaxonManager.GetTaxon(mUserContext, parentTaxonId);
            TaxonList taxonList   = parentTaxon.GetChildTaxonTree(mUserContext, true).GetChildTaxa();

            taxonList.Insert(0, parentTaxon);

            return(taxonList);
        }
        public void GetTaxonTree(int taxonId)
        {
            ITaxon taxon = CoreData.TaxonManager.GetTaxon(UserContext, taxonId);
            //CoreData.TaxonManager.GetTaxonTrees()
            ITaxonTreeNode taxonTreeNode = taxon.GetTaxonTree(UserContext, true);
            TaxonList      childTaxa     = taxonTreeNode.GetChildTaxa();

            ITaxonTreeNode taxonTreeNode2 = taxon.GetChildTaxonTree(UserContext, true);
            TaxonList      childTaxa2     = taxonTreeNode.GetChildTaxa();
        }
        public List <ITaxon> GetTaxonAndAllChildren(int taxonId)
        {
            List <ITaxon> taxa  = new List <ITaxon>();
            ITaxon        taxon = CoreData.TaxonManager.GetTaxon(UserContext, taxonId);

            taxa.Add(taxon);

            ITaxonTreeNode taxonTreeNode = taxon.GetChildTaxonTree(UserContext, true);
            TaxonList      childTaxa     = taxonTreeNode.GetChildTaxa();

            taxa.AddRange(childTaxa);
            return(taxa);
        }