public NodeModel DuplicateNode(INodeModel copiedNode, Dictionary <INodeModel, NodeModel> mapping, StackBaseModel pastedNodeParentStack, Vector2 delta, int stackInsertionIndex, List <StackedNodesStruct> implicitStackedNodes = null) { var pastedNodeModel = (NodeModel)copiedNode.Clone(); // Set graphmodel BEFORE define node as it is commonly use during Define pastedNodeModel.AssetModel = AssetModel; pastedNodeModel.Title = copiedNode.Title; pastedNodeModel.AssignNewGuid(); pastedNodeModel.DefineNode(); pastedNodeModel.ReinstantiateInputConstants(); mapping.Add(copiedNode, pastedNodeModel); if (pastedNodeParentStack != null) { pastedNodeParentStack.AddStackedNode(pastedNodeModel, stackInsertionIndex); } else { AddNode(pastedNodeModel); pastedNodeModel.Position += delta; if (pastedNodeModel is StackBaseModel pastedStackModel) { DuplicateStackedNodes(copiedNode, mapping, delta, stackInsertionIndex, implicitStackedNodes, pastedStackModel); } } return(pastedNodeModel); }