public async Task <DocumentBase <T> > ReadDocument <T>(string collectionId, string documentId) { if (string.IsNullOrWhiteSpace(collectionId)) { throw new ArgumentNullException(nameof(collectionId)); } if (string.IsNullOrWhiteSpace(documentId)) { throw new ArgumentNullException(nameof(documentId)); } // TODO (Savvas): Add framework logging var documentUri = UriFactory.CreateDocumentUri(dbId, collectionId, documentId); try { var responce = await client.ReadDocumentAsync(documentUri); var document = responce.Resource; DocumentWrapper <T> wrapper = (dynamic)document; return(wrapper.ToBase()); } catch (DocumentClientException e) when(e.StatusCode == HttpStatusCode.NotFound) { return(default(DocumentBase <T>)); } }