void visitStub(StubBase<?> stub, int parentId) {
        int idInCopy = copy.size();
        copy.addStub(idInCopy, parentId, getStubTypeIndex(stub.id));
        copy.myPlainList.add(stub);

        List<StubBase<?>> children = getChildrenStubs(stub.id);
        copy.prepareForChildren(idInCopy, children.size());

        for (StubBase<?> child : children) {
          visitStub(child, idInCopy);
        }
      }
void visitStub(StubBase<?> stub, int parentId)