code: public static EntityContainer getRootContainer(final EntityContainer container) {
  	Objects.requireNonNull(container);
  
  	if (container instanceof Entity) {
  	    final EntityContainer parent = ((Entity) container).getContainer();
  	    if (parent != null) {
  		return getRootContainer(parent);
  	    }
  	}
  	return container;
      }
docs: Gets the highest level parent of this container.
  
  @param container
  Container to get parent for.
  @return Highest level parent (or this container if it has no parent).