protected function model($model_name)
    {
        if(stripos($model_name, 'model') === false) {
            $model_name = sprintf('%s\models\%s', $this->server->getAppName(), $model_name);
        }

        if($hook_data = $this->modules->preModel($model_name)) {
            return $hook_data;
        }

        if(!class_exists($model_name)) {
            throw new exceptions\HttpInternalServerError("Class $model_name not found");
        }
        
        $model = new $model_name($this->modules);

        if($hook_data = $this->modules->postModel($model_name) === true) {
            return $hook_data;
        }

        return $model;
    }