// Populate navigation fields
model.set("priority", navigation.getPriority());
model.set("siteType", navigation.getSiteId().getType().getName());
model.set("siteName", navigation.getSiteId().getName());
ModelList nodesModel = model.get("nodes").setEmptyList();
if (rootNode.isChildrenLoaded()) {
for (Node child : rootNode) {
Model childModel = nodesModel.add();
PathAddress childAddress = address.append(child.getName());
if (scope > 0 || scope < 0) // Continue populating nodes in response
{
populateNode(child, scope - 1, childModel.setEmptyObject(), childAddress);
} else { // Populate node reference which can be followed