protected function generateTreeView($collection, $treeClass)
    {
        $content = [];
        foreach ($collection as $model) {
            /** @var ModelInterface $model */

            $toggleID = $model->getProviderName() . '_' . $treeClass . '_' . $model->getId();

            $content[] = $this->parseModel($model, $toggleID);

            if ($model->getMeta($model::HAS_CHILDREN) && $model->getMeta($model::SHOW_CHILDREN)) {
                $template = new ContaoBackendViewTemplate('widget_treepicker_child');
                $subHtml  = '';

                foreach ($model->getMeta($model::CHILD_COLLECTIONS) as $objChildCollection) {
                    $subHtml .= $this->generateTreeView($objChildCollection, $treeClass);
                }

                $template
                    ->setTranslator($this->getEnvironment()->getTranslator())
                    ->set('objParentModel', $model)
                    ->set('strToggleID', $toggleID)
                    ->set('strHTML', $subHtml)
                    ->set('strTable', $model->getProviderName());

                $content[] = $template->parse();
            }
        }

        return \implode("\n", $content);
    }