public function setup()
    {
        // Hack: skip if the request does not start with '/admin'
        $container = $this->app()->getContainer();
        if (substr(ltrim($container['request']->getUri()->getPath(), '/'), 0, 5) !== 'admin') {
            return $this;
        }

        // A session is necessary for the admin module
        if (session_id() === '') {
            session_start();
        }
        $container->register(new AdminServiceProvider());

        $module = $this;
        $container['charcoal/admin/module'] = function () use ($module) {
            return $module;
        };

        $adminConfig = $container['admin/config'];

        $this->setConfig($adminConfig);

        $groupIdent = '/'.trim($adminConfig['base_path'], '/');

        // Add the route group
        $this->app()->group($groupIdent, 'charcoal/admin/module:setupRoutes')
                    ->add('charcoal/admin/module:setupHandlers');

        return $this;
    }