protected function getPerPageFromModelClass($modelClass) {
        // We need this empty model to grab perPage and perPageMax parameters
        $model = new $modelClass;

        // If Model::$perPage equals 0, then pagination is disabled
        if ($model->getPerPage() == 0) {
            return $modelClass::all();
        }

        // The number of items per page can be overriden as a query parameter
        $perPage = Request::input('perPage', $model->getPerPage());

        // We make sure the $perPage parameter is not higher than the maximum for this model
        if ($perPage > $model->getPerPageMax()) {
            $perPage = $model->getPerPageMax();
        }

        return $perPage;
    }