code: CompletableFuture<Void> removeEntities(String scope, String stream, Collection<Long> entities) {
          Set<Integer> collections = entities.stream().collect(Collectors.groupingBy(x -> new Position(x).collectionNumber)).keySet();
          return Futures.allOf(entities.stream()
                                       .map(entity -> storeHelper.deletePath(getEntityPath(scope, stream, entity), false))
                                       .collect(Collectors.toList()))
                        .thenCompose(v -> Futures.allOf(
                                collections.stream().map(collectionNum -> isSealed(scope, stream, collectionNum)
                                        .thenCompose(sealed -> {
                                            if (sealed) {
                                                return tryDeleteSealedCollection(scope, stream, collectionNum);
                                            } else {
                                                return CompletableFuture.completedFuture(null);
                                            }
                                        })).collect(Collectors.toList())))
                        .whenComplete((r, e) -> {
                            if (e != null) {
                                log.error("error encountered while trying to remove entity positions {} for stream {}/{}", entities, scope, stream, e);
                            } else {
                                log.debug("entities at positions {} removed for stream {}/{}", entities, scope, stream);
                            }
                        });
      }
docs: Method to remove entities from the ordered set. Entities are referred to by their position pointer.
  @param scope scope
  @param stream stream
  @param entities list of entities' positions to remove
  @return CompletableFuture which when completed will indicate that entities are removed from the set.