code: long applyMappingToRepo(
        EntityMapping sourceMapping, Repository<Entity> targetRepo, Progress progress, int depth) {
      progress.status(format("Mapping source [%s]...", sourceMapping.getLabel()));
      AtomicLong counter = new AtomicLong();
  
      boolean canAdd = targetRepo.count() == 0;
      dataService
          .getRepository(sourceMapping.getName())
          .forEachBatched(
              entities ->
                  processBatch(sourceMapping, targetRepo, progress, counter, canAdd, entities, depth),
              MAPPING_BATCH_SIZE);
  
      progress.status(format("Mapped %s [%s] entities.", counter, sourceMapping.getLabel()));
      return counter.get();
    }
docs: Package-private for testability