public function update($id, array &$doc)
    {
        $json = JSONEncoder::encode($doc);

        $response = $this->client->request('PUT', "/{$this->name}/{$id}", [
            'body'    => $json,
            'headers' => ['Content-Type' => 'application/json'],
        ]);

        if (201 !== $response->getStatusCode()) {
            throw new Exception('Unable to save document');
        }

        $value = JSONEncoder::decode((string) $response->getBody());

        $doc['_id'] = $value['id'];
        $doc['_rev'] = $value['rev'];
    }