public async Task <TreeNode <NavigationNode> > GetTree()
        {
            var builder  = GetRootTreeBuilder();
            var cacheKey = await _cacheKeyResolver.GetCacheKey(builder);

            var tree = await _treeCache.GetTree(cacheKey).ConfigureAwait(false);

            if (tree != null)
            {
                return(tree);
            }
            tree = await builder.BuildTree(this).ConfigureAwait(false);

            if (_navOptions.RootTreeBuilderName != Constants.ReflectionNavigationTreeBuilderName &&
                !string.IsNullOrEmpty(_navOptions.IncludeAssembliesForScan))
            {
                var helper = new NavigationTreeReflectionConverter();
                await helper.ScanAndMerge(this, _navOptions.IncludeAssembliesForScan, tree).ConfigureAwait(false);
            }
            if (_navOptions.EnableSorting)
            {
                SortTreeNode(tree);
            }
            await _treeCache.AddToCache(tree, cacheKey);

            return(tree);
        }
        private async Task <TreeNode <NavigationNode> > BuildTreeInternal(NavigationTreeBuilderService service)
        {
            if (string.IsNullOrEmpty(_navOptions.IncludeAssembliesForScan))
            {
                _log.LogError("unable to build navigation tree, 'IncludeAssembliesForScan' not specified. ");

                var rootNav = new NavigationNode();
                rootNav.Key = "RootNode";
                //rootNav.IsRootNode = true;
                rootNav.Text = "Missing config for IncludeAssembliesForScan";
                rootNav.Url  = "/";
                var treeRoot = new TreeNode <NavigationNode>(rootNav);

                return(treeRoot);
            }

            var helper = new NavigationTreeReflectionConverter();

            return(await helper.ScanAndMerge(service, _navOptions.IncludeAssembliesForScan, null).ConfigureAwait(false));
        }