code: public static int getEntityCountRecursively(final EntityContainer container) {
  	final AtomicInteger result = new AtomicInteger();
  
  	walkEntityTree(container, e -> {
  	    result.incrementAndGet();
  	    return EntityVisitResult.CONTINUE;
  	});
  
  	return result.get();
      }
docs: Gets the total entity count (recursive).
  
  @param container
  Entity container.
  
  @return Total entity count.
  
  @see #walkEntityTree(EntityContainer, EntityVisitor)