protected function normalizeOrder($order)
    {
        switch (strtolower($order)) {
            case 'asc':
                return 'asc';
            case 'desc':
                return 'desc';
            default:
                throw new QueryException(sprintf('Unsupported sorting method "%s" in query "%s"', $this->getType($order), $this->model->entity()));

        }
    }