public object Visit(ViewerNode node)
        {
            string name   = (node.Content ?? node).ToString() + idGen.ToString();
            var    parent = new NodeModel()
            {
                ID          = idGen++,
                Data        = name,
                Type        = node.Type,
                Connections = new List <int>(),
            };

            Context.Nodes.Add(parent.ID, parent);
            if (node.Children != null)
            {
                foreach (Node nodeChild in node.Children)
                {
                    ViewerNode viewerNode;
                    if (nodeChild is ViewerNode)
                    {
                        viewerNode = nodeChild as ViewerNode;
                    }
                    else
                    {
                        viewerNode = new ViewerNode(nodeChild);
                    }
                    var child = Visit(viewerNode) as NodeModel;
                    parent.Connections.Add(child.ID);
                }
            }
            return(parent);
        }
        public object Visit(Node node)
        {
            var result = new ViewerNode(node);

            foreach (var child in node.Children)
            {
                result.Children.Add((Node)child.AcceptVisitor(this));
            }
            return(result);
        }
 object IViewerVisitor.Visit(ViewerNode node)
 {
     return(Visit((Node)node));
 }