protected function flattenTree(array $aItems, &$aOutput = []): array
    {
        foreach ($aItems as $oItem) {
            $aOutput[] = $oItem;
            $this->flattenTree($oItem->children, $aOutput);
            unset($oItem->children);
        }

        return $aOutput;
    }