protected function resolveHandler(Query $query)
    {
        if ($query instanceof ReadQuery) {
            return new ReadQueryHandler($this);
        }

        if ($query instanceof InsertQuery) {
            return new InsertQueryHandler($this);
        }

        if ($query instanceof DeleteQuery) {
            return new DeleteQueryHandler($this);
        }

        if ($query instanceof UpdateQuery) {
            return new UpdateQueryHandler($this);
        }

        throw new Exception('Could not resolve handler for query');
    }