PETreeNode Add(GameObject go, PETreeNode parent, bool includeChildren = true)
    {
        var isExpanded = expandedDict[go];

        var node = new PETreeNode(isExpanded)
        {
            content = new GUIContent(go.name, PEResources.icon), UserData = go
        };

        parent.children.Add(node);
        node.OnExpandChanged += expanded => expandedDict[go] = expanded;

        var pi = go.GetComponent <PEPrefabScript>();

        if (pi)
        {
            var isRoot = PEUtils.FindRootPrefab(pi.gameObject) == pi.Prefab ||
                         PrefabUtility.GetPrefabParent(pi.gameObject) == pi.Prefab;
            if (isRoot)
            {
                node.color         = Color.green;
                node.content.text += " (Root)";
            }
            else
            {
                node.color         = Color.yellow;
                node.content.text += " (Nested)";
            }
        }
        if (prefabScript.Modifications.TransformParentChanges.Any(npo => npo.child == go.transform))
        {
            node.color         = Color.cyan;
            node.content.text += " (Parent Changed)";
        }
        else
        if (prefabScript.Modifications.NonPrefabObjects.Any(c => c.child == go.transform))
        {
            node.color         = Color.yellow;
            node.content.text += " (New)";
        }

        if (!includeChildren)
        {
            return(node);
        }

        foreach (var property in GetProperties(go))
        {
            Add(property, node);
        }

        foreach (Component component in go.GetComponents <Component>())
        {
            Add(component, node);
        }

        foreach (Transform transform in go.transform)
        {
            var nd = Add(transform.gameObject, node);
            if (nd.children.Count == 0 && nd.color == Color.white)
            {
                node.children.Remove(nd);
            }
        }

        foreach (var obj in GetRemovedObjects(go, prefabScript))
        {
            PETreeNode nd        = null;
            var        component = obj as Component;
            if (component != null)
            {
                nd = Add(component, node, false);
            }
            else
            {
                var gameObject = obj as GameObject;
                if (gameObject != null)
                {
                    nd = Add(gameObject, node, false);
                }
            }

            if (nd != null)
            {
                nd.color         = Color.red;
                nd.content.text += " (Removed)";
            }
        }

        return(node);
    }