private void populateContainer(
      HierarchicalContainer container, List<NodeDTO> nodes, NodeDTO parent) {

    for (NodeDTO node : nodes) {
      Item item = container.addItem(node);
      item.getItemProperty(TreePropertyID.NÁZEV).setValue(node.getName());
      container.setChildrenAllowed(node, true);
      if (parent != null) container.setParent(node, parent);

      List<NodeDTO> childrenNodes = nodeFacade.getNodesByParentNode(node);
      if (childrenNodes != null) populateContainer(container, childrenNodes, node);
    }
  }
  @Override
  protected HierarchicalContainer populateContainerTable() {
    dataSource = new HierarchicalContainer();

    dataSource.addContainerProperty(ViewConstants.PROPERTY_NAME, String.class, null);
    dataSource.addContainerProperty(ViewConstants.PROPERTY_LINK, Link.class, null);

    for (final MetadataRecord metadataRecord : resourceProxy.getMetadataRecords()) {
      Metadata md = Metadata.newInstance(metadataRecord);
      Item item = dataSource.addItem(md);
      if (item != null) {
        item.getItemProperty(ViewConstants.PROPERTY_NAME).setValue(metadataRecord.getName());
        item.getItemProperty(ViewConstants.PROPERTY_LINK).setValue(buildLink(metadataRecord));
      }
    }

    return dataSource;
  }