public IAmAnEvent[] Load(Guid id)
        {
            Uri uri = _databaseDetails.UriForAnExistingDocument(id);
            HttpWebRequest request = new HttpWebRequestFactory(uri, HttpMethod.GET)
                .WithBasicAuthorisation(_databaseDetails.CredentialsEncodedForBasicAuth)
                .Build();               

            var response =_webRequestGateway.SafelyMakeRequest(request).ThrowExceptionsForAnyFailures(HttpStatusCode.OK);
            return _documentMapper.Map(response);
        }
        public void Persist(Events theEvents)
        {
            byte[] requestBody = theEvents.Encode(new Utf8JsonEncoder());
            Uri pathToNewDocument = _couchDbDatabaseDetails.UriForANewDocument;
            HttpWebRequest request =
                new HttpWebRequestFactory(pathToNewDocument, HttpMethod.PUT)
                    .WithBasicAuthorisation(_couchDbDatabaseDetails.CredentialsEncodedForBasicAuth)
                    .WithContent(MimeType.APPLICATIONJSON, requestBody)
                    .Build();

            _requestGateway.SafelyMakeRequest(request).ThrowExceptionsForAnyFailures(HttpStatusCode.Created);
        }