public function createDesignDocument($designDocName, DesignDocument $designDoc)
    {
        $data = $designDoc->getData();
        $data['_id'] = '_design/'.$designDocName;

        $documentPath = '/'.$this->databaseName.'/'.$data['_id'];
        $response = $this->httpClient->request('GET', $documentPath);

        if ($response->status == 200) {
            $docData = $response->body;
            $data['_rev'] = $docData['_rev'];
        }

        return $this->httpClient->request(
            'PUT',
            sprintf('/%s/_design/%s', $this->databaseName, $designDocName),
            json_encode($data)
        );
    }