// for each application or container on the top-level container, convert it into a ModelObject and add
// to the list of children to return
for (ContainerItem containerItem : containerChildren) {
if (containerItem instanceof Container) {
Container containerItemContainer = (Container) containerItem;
// it's a container, so, we might have yet another level of children to convert
// also, we need information about which type of container it is, and this is expressed by the
// template property, as there's pretty much no difference between a column container and a row
// container at the storage level
org.exoplatform.portal.config.model.Container child = new org.exoplatform.portal.config.model.Container();
child.setTemplate(containerItemContainer.getTemplate());
child.setAccessPermissions(Util.from(containerItemContainer.getAccessPermission()));
child.setMoveAppsPermissions(Util.from(containerItemContainer.getMoveAppsPermission()));
child.setMoveContainersPermissions(Util.from(containerItemContainer.getMoveContainersPermission()));
// recursive call, to convert all the children into model objects for this container
child.setChildren(getModelObjectsFor(containerItemContainer));
// and finally, add to the list of children