protected function init()
    {
        parent::init();

        $models = $this->getManagedModels();

        if ($this->getRequest()->param('ModelClass')) {
            $this->modelClass = $this->unsanitiseClassName($this->getRequest()->param('ModelClass'));
        } else {
            reset($models);
            $this->modelClass = key($models);
        }

        // security check for valid models
        if (!array_key_exists($this->modelClass, $models)) {
            user_error('ModelAdmin::init(): Invalid Model class', E_USER_ERROR);
        }
    }