protected function handleSortRequest($cols, $model)
    {
        foreach ($cols as $col) {
            $dir = 'asc';

            if (substr($col, 0, 1) == '-') {
                $dir = 'desc';
                $col = substr($col, 1);
            }

            $model = $model->orderBy($col, $dir);
        }
        return $model;
    }