public function sort($column, $type = 'ASC')
    {
        if ($this->queryType !== self::QUERY_SELECT) {
            $this->exception = new QueryException("Sorting can only be applied on SELECT mode!", 0, $this->exception);
            return $this;
        }

        // First lets upper the type.
        $type = strtoupper($type);

        if (! is_string($column)) {
            $this->exception = new QueryException("Sorting column must be an string!", 0, $this->exception);
        }

        if (! $this->validOrderType($type)) {
            $this->exception = new QueryException("Sorting requires a type that is either 'ASC' or 'DESC'!", 0, $this->exception);
            return $this;
        }

        // Validate the column
        if (in_array($column, $this->structure->columnNames)) {
            $this->sortBy = $column;
            $this->sortOrder = $type;
        }

        return $this;
    }