/// <summary>
        /// Creates a tree node for a content item based on an UmbracoEntity
        /// </summary>
        /// <param name="e"></param>
        /// <param name="parentId"></param>
        /// <param name="queryStrings"></param>
        /// <returns></returns>
        protected override TreeNode GetSingleTreeNode(IUmbracoEntity e, string parentId, FormDataCollection queryStrings)
        {
            var entity = (UmbracoEntity)e;

            //Special check to see if it ia a container, if so then we'll hide children.
            var isContainer = e.IsContainer(); // && (queryStrings.Get("isDialog") != "true");

            var node = CreateTreeNode(
                e.Id.ToInvariantString(),
                parentId,
                queryStrings,
                e.Name,
                entity.ContentTypeIcon,
                entity.HasChildren && (isContainer == false));

            node.AdditionalData.Add("contentType", entity.ContentTypeAlias);

            if (isContainer)
            {
                node.SetContainerStyle();
                node.AdditionalData.Add("isContainer", true);
            }

            return(node);
        }
        /// <summary>
        /// Creates a tree node for a content item based on an UmbracoEntity
        /// </summary>
        /// <param name="e"></param>
        /// <param name="parentId"></param>
        /// <param name="queryStrings"></param>
        /// <returns></returns>
        protected override TreeNode GetSingleTreeNode(IUmbracoEntity e, string parentId, FormDataCollection queryStrings)
        {
            var entity = (UmbracoEntity)e;

            var allowedUserOptions = GetAllowedUserMenuItemsForNode(e);

            if (CanUserAccessNode(e, allowedUserOptions))
            {
                //Special check to see if it ia a container, if so then we'll hide children.
                var isContainer = e.IsContainer();   // && (queryStrings.Get("isDialog") != "true");

                var hasChildren = ShouldRenderChildrenOfContainer(e);

                var node = CreateTreeNode(
                    entity,
                    Constants.ObjectTypes.DocumentGuid,
                    parentId,
                    queryStrings,
                    hasChildren);

                node.AdditionalData.Add("contentType", entity.ContentTypeAlias);

                if (isContainer)
                {
                    node.AdditionalData.Add("isContainer", true);
                    node.SetContainerStyle();
                }


                if (entity.IsPublished == false)
                {
                    node.SetNotPublishedStyle();
                }

                if (entity.HasPendingChanges)
                {
                    node.SetHasUnpublishedVersionStyle();
                }

                if (Services.PublicAccessService.IsProtected(e.Path))
                {
                    node.SetProtectedStyle();
                }

                return(node);
            }

            return(null);
        }
        /// <summary>
        /// Before we make a call to get the tree nodes we have to check if they can actually be rendered
        /// </summary>
        /// <param name="id"></param>
        /// <param name="queryStrings"></param>
        /// <returns></returns>
        /// <remarks>
        /// Currently this just checks if it is a container type, if it is we cannot render children. In the future this might check for other things.
        /// </remarks>
        private TreeNodeCollection GetTreeNodesInternal(string id, FormDataCollection queryStrings)
        {
            IUmbracoEntity current = GetEntityFromId(id);

            //before we get the children we need to see if this is a container node

            //test if the parent is a listview / container
            if (current != null && current.IsContainer())
            {
                //no children!
                return(new TreeNodeCollection());
            }

            return(PerformGetTreeNodes(id, queryStrings));
        }
        /// <summary>
        /// Check to see if we should return children of a container node
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        /// <remarks>
        /// This is required in case a user has custom start nodes that are children of a list view since in that case we'll need to render the tree node. In normal cases we don't render
        /// children of a list view.
        /// </remarks>
        protected bool ShouldRenderChildrenOfContainer(IUmbracoEntity e)
        {
            var isContainer = e.IsContainer();

            var renderChildren = e.HasChildren() && (isContainer == false);

            //Here we need to figure out if the node is a container and if so check if the user has a custom start node, then check if that start node is a child
            // of this container node. If that is true, the HasChildren must be true so that the tree node still renders even though this current node is a container/list view.
            if (isContainer && UserStartNodes.Length > 0 && UserStartNodes.Contains(Constants.System.Root) == false)
            {
                var startNodes = Services.EntityService.GetAll(UmbracoObjectType, UserStartNodes);
                //if any of these start nodes' parent is current, then we need to render children normally so we need to switch some logic and tell
                // the UI that this node does have children and that it isn't a container
                if (startNodes.Any(x => x.ParentId == e.Id))
                {
                    renderChildren = true;
                }
            }

            return(renderChildren);
        }