public function applySelect(SelectQuery $query, array $sortClauses)
    {
        foreach ($sortClauses as $nr => $sortClause) {
            foreach ($this->handlers as $handler) {
                if ($handler->accept($sortClause)) {
                    foreach ((array)$handler->applySelect($query, $sortClause, $nr) as $column) {
                        if (strrpos($column, '_null', -6) === false) {
                            $direction = $sortClause->direction;
                        } else {
                            // Always sort null last
                            $direction = SelectQuery::ASC;
                        }

                        $this->sortColumns[$column] = $direction;
                    }
                    continue 2;
                }
            }

            throw new RuntimeException('No handler available for sort clause: ' . get_class($sortClause));
        }
    }