title: c# Cosmos Db check if file exists before creating
body: <p>I have this method:</p>
  
  <pre><code>public async Task SaveAsync(IEnumerable&lt;JObject&gt; models)
  {
      foreach (var document in models)
      {
          var collectionLink = UriFactory.CreateDocumentCollectionUri(_databaseName, _collectionName);
          await _client.CreateDocumentAsync(collectionLink, document);
      }
  }
  </code></pre>
  
  <p>Which is fine when creating multiple documents at once, but if I have a document that has the same id as one already in the database I get an error: </p>
  
  <blockquote>
    <p>Entity with the specified id already exists in the system.</p>
  </blockquote>
  
  <p>Because the document is actually different I am not sure I can check to see if it exists already.</p>
  
  <p>Is there a way of replacing the existing entity with the new one?</p>