public function beforeRender(Controller $controller) {
        $badges = array();

        foreach (Configure::read('Admin.menu') as $section => $menu) {
            $badges[$section] = $menu['count'];
        }

        $controller->set('badgeCounts', $badges);

        if (isset($controller->Model)) {
            $controller->set('model', $controller->Model);
        }

        if (isset($controller->request->params['override'])) {
            $controller->layout = 'Admin.admin';
            $controller->request->params['action'] = str_replace('admin_', '', $controller->action);
        }
    }