public IEnumerable <TypeData> AddType(AssemblyDefinition assembly, TypeDefinition type)
        {
            bool     isCompilerGenerated = Name.IsCompilerGenerated(type.Name);
            bool     isAsyncStateType    = false;
            NodeData typeNode            = null;

            if (isCompilerGenerated)
            {
                // Check if the type is a async state machine type
                isAsyncStateType = type.Interfaces.Any(it => it.InterfaceType.Name == "IAsyncStateMachine");

                // AsyncStateTypes are only partially included. The state types are not included as nodes,
                // but are parsed to extract internal types and references.
                if (!isAsyncStateType)
                {
                    // Some other internal compiler generated type, which is ignored for now
                    // Log.Warn($"Exclude compiler type {type.Name}");
                    yield break;
                }
            }
            else
            {
                string name      = Name.GetTypeFullName(type);
                bool   isPrivate = type.Attributes.HasFlag(TypeAttributes.NestedPrivate);
                string parent    = isPrivate
                    ? $"{NodeName.From(name).ParentName.FullName}.$private" : null;
                string description = xmlDockParser.GetDescription(name);

                if (IsNameSpaceDocType(type, description))
                {
                    // Type was a namespace doc type, extract it and move to next type
                    yield break;
                }

                typeNode = new NodeData(name, parent, NodeData.TypeType, description);
                nodeCallback(typeNode);
            }

            yield return(new TypeData(type, typeNode, isAsyncStateType));

            // Iterate all nested types as well
            foreach (var nestedType in type.NestedTypes)
            {
                // Adding a type could result in multiple types
                foreach (var types in AddType(assembly, nestedType))
                {
                    yield return(types);
                }
            }
        }
        public Node GetParentNode(NodeName parentName, NodeType childNodeType, bool isQueued)
        {
            if (modelService.TryGetNode(parentName, out Node parent))
            {
                if (isQueued && parentName == NodeName.Root)
                {
                    return(GetParentNode(NodeName.From("$Externals"), NodeType.Group, false));
                }

                return(parent);
            }

            NodeType parentNodeType = GetParentNodeType(parentName, childNodeType);

            NodeName grandParentName = parentName.ParentName;
            Node     grandParent     = GetParentNode(grandParentName, parentNodeType, isQueued);

            parent          = new Node(parentName);
            parent.NodeType = parentNodeType;

            AddNode(parent, grandParent);
            return(parent);
        }