Get rid of recursion N+1 while setting node children