CompletableFuture<Boolean> deleteMetadataAsync(CloudBlobMetadata blobMetadata) {
    // Note: not timing here since bulk deletions are timed.
    return cosmosAsyncContainer.deleteItem(blobMetadata.getId(), new PartitionKey(blobMetadata.getPartitionId()))
        .toFuture()
        .handle((response, throwable) -> {
          if (throwable != null) {
            Exception ex = Utils.extractFutureExceptionCause(throwable);
            if (ex instanceof CosmosException && ((CosmosException) ex).getStatusCode() == STATUS_NOT_FOUND) {
              // If the cosmos exception is due to entry not being found, return false. This can happen on retry of delete operation.
              logger.debug("Could not find metadata for blob {} to delete", blobMetadata.getId());
              return false;
            }
            throw throwable instanceof CompletionException ? (CompletionException) throwable
                : new CompletionException(ex);
          }
          return true;
        });
  }
Delete the blob metadata document in the CosmosDB container asynchronously, if it exists.
@param blobMetadata the blob metadata document to delete.
@return a {@link CompletableFuture} that will eventually contain {@link Boolean} flag indicating if the record was
        deleted, or a {@link CosmosException} if an error occurred.
ambry-cloud/src/main/java/com/github/ambry/cloud/azure/CosmosDataAccessor.java