private static TaxonomyNode ExpandAncestorsForPage(string pageUri, string taxonomyUri, NavigationFilter filter, Localization localization)
        {
            using (new Tracer(pageUri, taxonomyUri, filter, localization))
            {
                // Get TaxonomyRelationManager.GetTaxonomyKeywords may return multiple paths towards the (same) Taxonomy root.
                TaxonomyRelationManager taxonomyRelationManager = new TaxonomyRelationManager();
                Keyword[] contextKeywords = new Keyword[0];
                Keyword[] taxonomyRoots   = taxonomyRelationManager.GetTaxonomyKeywords(taxonomyUri, pageUri, contextKeywords, new DepthFilter(-1, DepthFilter.FilterUp), (int)ItemType.Page);
                if (taxonomyRoots == null || taxonomyRoots.Length == 0)
                {
                    Log.Debug("Page '{0}' is not classified in Taxonomy '{1}.", pageUri, taxonomyUri);
                    return(null);
                }

                TaxonomyNode[] taxonomyRootNodes = taxonomyRoots.Select(kw => CreateTaxonomyNode(kw, -1, filter, localization)).ToArray();

                // Merge all returned paths into a single subtree
                TaxonomyNode mergedSubtreeRootNode = taxonomyRootNodes[0];
                foreach (TaxonomyNode taxonomyRootNode in taxonomyRootNodes.Skip(1))
                {
                    MergeSubtrees(taxonomyRootNode, mergedSubtreeRootNode);
                }

                return(mergedSubtreeRootNode);
            }
        }
        private static TaxonomyNode ExpandAncestorsForPage(string pageUri, string taxonomyUri, NavigationFilter filter, Localization localization)
        {
            using (new Tracer(pageUri, taxonomyUri, filter, localization))
            {
                // Get TaxonomyRelationManager.GetTaxonomyKeywords may return multiple paths towards the (same) Taxonomy root.
                TaxonomyRelationManager taxonomyRelationManager = new TaxonomyRelationManager();
                Keyword[] contextKeywords = new Keyword[0];
                Keyword[] taxonomyRoots = taxonomyRelationManager.GetTaxonomyKeywords(taxonomyUri, pageUri, contextKeywords, new DepthFilter(-1, DepthFilter.FilterUp), (int) ItemType.Page);
                if (taxonomyRoots == null || taxonomyRoots.Length == 0)
                {
                    Log.Debug("Page '{0}' is not classified in Taxonomy '{1}.", pageUri, taxonomyUri);
                    return null;
                }

                TaxonomyNode[] taxonomyRootNodes = taxonomyRoots.Select(kw => CreateTaxonomyNode(kw, -1, filter, localization)).ToArray();

                // Merge all returned paths into a single subtree
                TaxonomyNode mergedSubtreeRootNode = taxonomyRootNodes[0];
                foreach (TaxonomyNode taxonomyRootNode in taxonomyRootNodes.Skip(1))
                {
                    MergeSubtrees(taxonomyRootNode, mergedSubtreeRootNode);
                }

                return mergedSubtreeRootNode;
            }
        }