public static void GetRelating(ICswResources CswResources, CswNbtExplorerRelatingReturn RelatingNodes, CswNbtExplorerRequest Req)
        {
            CswNbtResources NbtResources = (CswNbtResources)CswResources;

            CswNbtView view = new CswNbtView(NbtResources);

            if (Req.RelatingId.StartsWith("OC_"))
            {
                int ObjClassId = CswConvert.ToInt32(Req.RelatingId.Substring(Req.RelatingId.LastIndexOf('_') + 1));
                CswNbtMetaDataObjectClass     ObjClass        = NbtResources.MetaData.getObjectClass(ObjClassId);
                CswNbtMetaDataObjectClassProp objectClassProp = ObjClass.getObjectClassProp(Req.RelatingPropId);

                CswNbtViewRelationship parent = view.AddViewRelationship(ObjClass, true);
                CswPrimaryKey          pk     = CswConvert.ToPrimaryKey(Req.NodeId);
                view.AddViewPropertyAndFilter(parent, objectClassProp, Value: pk.PrimaryKey.ToString(), SubFieldName: CswEnumNbtSubFieldName.NodeID);
            }
            else
            {
                int NtId = CswConvert.ToInt32(Req.RelatingId.Substring(Req.RelatingId.LastIndexOf('_') + 1));
                CswNbtMetaDataNodeType     NodeType = NbtResources.MetaData.getNodeType(NtId);
                CswNbtMetaDataNodeTypeProp ntp      = NodeType.getNodeTypeProp(Req.RelatingPropId);

                CswNbtViewRelationship parent = view.AddViewRelationship(NodeType, true);
                CswPrimaryKey          pk     = CswConvert.ToPrimaryKey(Req.NodeId);
                view.AddViewPropertyAndFilter(parent, ntp, Value: pk.PrimaryKey.ToString(), SubFieldName: CswEnumNbtSubFieldName.NodeID);
            }

            ICswNbtTree tree = NbtResources.Trees.getTreeFromView(view, false, false, false);

            for (int i = 0; i < tree.getChildNodeCount(); i++)
            {
                tree.goToNthChild(i);
                CswNbtNodeKey          nodeKey  = tree.getNodeKeyForCurrentPosition();
                string                 nodeName = tree.getNodeNameForCurrentPosition();
                CswNbtMetaDataNodeType nodetype = NbtResources.MetaData.getNodeType(nodeKey.NodeTypeId);
                RelatingNodes.Data.Add(nodeName, nodeKey.NodeId, nodetype.NodeTypeName, string.Empty, string.Empty, string.Empty);
                tree.goToParentNode();
            }
        }
        public static void Initialize(ICswResources CswResources, CswNbtExplorerReturn Return, CswNbtExplorerRequest Request)
        {
            CswNbtResources NbtResources = (CswNbtResources)CswResources;
            CswPrimaryKey   NodeId       = CswConvert.ToPrimaryKey(Request.NodeId);

            if (Request.Depth <= 4 || Request.Depth > 0)  //We never want a request higher than 4 and 0 doesn't make sense
            {
                MAX_DEPTH = Request.Depth;
            }

            FilterVal = new CswCommaDelimitedString();
            if (String.IsNullOrEmpty(Request.FilterVal))
            {
                FilterVal.FromString(CswNbtArborGraph._setDefaultFilterVal(NbtResources));
            }
            else
            {
                FilterVal.FromString(Request.FilterVal);
            }


            StartingNode = NbtResources.Nodes[NodeId];
            CswNbtMetaDataNodeType startingNT = StartingNode.getNodeType();

            //Add the initial node to the graph
            _addToGraph(Return, StartingNode.NodeName, string.Empty, NodeId.ToString(), startingNT.IconFileName, 0, "Instance", NodeId.ToString(), startingNT.NodeTypeName, Int32.MinValue);

            _recurseForRelatingNodes(NbtResources, Return, StartingNode, 1, NodeId.ToString());

            _recurseForRelatedNTs(NbtResources, Return, StartingNode.NodeTypeId, 1, NodeId.ToString());
        }