According to the code above you put parent document into childMenuList....
How many levels you want to go down? With those 2 dictionaries you could go just 2 levels, e.g. all parents and all children and you also loose relation between parent-child (you don't know who is parent for particular document).
So I'd try to build tree structure instead, some like this:
class MyClass {
Guid DocGuid;
string DocName;
List<MyClass> Children;
}
In addition following row gets all the documents of the site
var menu1 = DocumentHelper.GetDocuments().OnSite("NewSite").Culture("en-US");
It is ok if you really need to pull all the docs, otherwise I'd limit it to x levels.
Also next line of code finds searches for document parent and places it into childMenu variable:
var childMenu = DocumentHelper.GetDocuments().OnSite("NewSite").Culture("en-US").InRelationWith(document.NodeGUID, "RelationProducts").Where(x => x.DocumentID == document.Parent.DocumentID);
Either variable name is wrong or you need to adjust where condition to:
var childMenu = DocumentHelper.GetDocuments().OnSite("NewSite").Culture("en-US").InRelationWith(document.NodeGUID, "RelationProducts").Where(x => x.Parent.DocumentID== document.DocumentID);
Also not sure why you're checking related products...
Last, but not least, you're using LINQ in where condition - it does not work with Kentico Document Query, so SQL server executes this part:
DocumentHelper.GetDocuments().OnSite("NewSite").Culture("en-US").InRelationWith(document.NodeGUID, "RelationProducts")
and the rest is processed on web server:
.Where(x => x.Parent.DocumentID== document.DocumentID);
I'd recommend you to use Document Query only, so you get better performance.