protected function getBranch($pages)
    {
        $result = [];

        foreach ($pages as $page) {
            $result[] = array('model' => $page, 'children' => $this->renderTree($page->id));
        }

        return $result;
    }