private function printTree(IO $io, PuliResource $resource, &$total, $prefix = '')
    {
        // The root node has an empty name
        $children = $resource->listChildren();
        $lastIndex = count($children) - 1;
        $index = 0;

        foreach ($children as $child) {
            $isLastChild = $index === $lastIndex;
            $childPrefix = $isLastChild ? self::LAST_CHILD_PREFIX : self::CHILD_PREFIX;
            $nestingPrefix = $isLastChild ? self::NESTING_CLOSED_PREFIX : self::NESTING_OPEN_PREFIX;

            $name = $child->getName() ?: '/';

            if ($child->hasChildren()) {
                $name = '<c1>'.$name.'</c1>';
            }

            $io->writeLine($prefix.$childPrefix.$name);

            $this->printTree($io, $child, $total, $prefix.$nestingPrefix);

            ++$index;
            ++$total;
        }
    }