public function put($documentId, array $doc)
    {
        $context = array('http' => array());

        $context['http']['method'] = 'PUT';
        $context['http']['header'] = 'Content-Type: application/json';
        $context['http']['content'] = json_encode($doc);

        $rev = isset($doc['_rev']) ? '?rev=' . $doc['_rev'] : '';
        list($status, $response) = $this->sendRequest(urlencode($documentId) . $rev, $context);

        if ($status == 409) {
            throw new Exception\Conflict('PUT /' . $documentId . ' failed.');
        } elseif ($status != 201) {
            throw new Exception\Response('PUT /' . $documentId . ' - Unknown response status.');
        }

        if (isset($response['id'])) {
            return array('_id' => $response['id'], '_rev' => $response['rev']);
        } else {
            return $response;
        }
    }