public function renderChildrenIntoParentColumns($typoScriptSetup = [], $sortColumns = [])
    {

        // first we have to make a backup copy of the original data array
        // and we have to modify the depth counter to avoid stopping too early

        $currentParentGrid = $this->copyCurrentParentGrid();
        $columns = $this->getUsedColumns($sortColumns);
        $parentGridData = $this->getParentGridData($currentParentGrid['data']);
        $parentGridData['tx_gridelements_view_columns'] = $columns;

        $counter = !empty($this->cObj->data['tx_gridelements_view_children']);
        $parentRecordNumbers = [];
        $this->getTSFE()->cObjectDepthCounter += $counter;

        // each of the children will now be rendered separately and the output will be added to it's particular column
        $rawColumns = [];
        if (!empty($this->cObj->data['tx_gridelements_view_children'])) {
            foreach ($this->cObj->data['tx_gridelements_view_children'] as $child) {
                $rawColumns[$child['tx_gridelements_columns']][] = $child;
                $renderedChild = $child;
                $this->renderChildIntoParentColumn(
                    $columns,
                    $renderedChild,
                    $parentGridData,
                    $parentRecordNumbers,
                    $typoScriptSetup
                );
                $currentParentGrid['data']['tx_gridelements_view_child_' . $child['uid']] = $renderedChild;
                unset($renderedChild);
            }
            $currentParentGrid['data']['tx_gridelements_view_raw_columns'] = $rawColumns;
        }

        // now we can reset the depth counter and the data array so that the element will behave just as usual
        // it will just contain the additional tx_gridelements_view section with the prerendered elements
        // it is important to do this before any stdWrap functions are applied to the grid container
        // since they will depend on the original data
        $this->getTSFE()->cObjectDepthCounter -= $counter;

        $this->cObj->currentRecord = $currentParentGrid['record'];
        $this->cObj->data = $currentParentGrid['data'];
        $this->cObj->parentRecordNumber = $currentParentGrid['parentRecordNumber'];

        if (!empty($sortColumns)) {
            $this->cObj->data['tx_gridelements_view_columns'] = [];
            foreach ($sortColumns as $sortKey) {
                $sortKey = trim($sortKey);
                if (isset($parentGridData['tx_gridelements_view_columns'][$sortKey])) {
                    $this->cObj->data['tx_gridelements_view_columns'][$sortKey] = $parentGridData['tx_gridelements_view_columns'][$sortKey];
                }
            }
        }
        unset($parentGridData);
        unset($currentParentGrid);
    }