code: public static Instance replicateInstance( Instance instance ) {
  
  		Map<Instance,Instance> instanceToDuplicate = new HashMap<> ();
  		List<Instance> toProcess = new ArrayList<> ();
  		toProcess.add( instance );
  
  		while( ! toProcess.isEmpty()) {
  			Instance current = toProcess.remove( 0 );
  
  			Instance copy = new Instance();
  			copy.name( current.getName());
  			copy.component( current.getComponent());
  			copy.channels.addAll( current.channels );
  			copy.overriddenExports.putAll( current.overriddenExports );
  			instanceToDuplicate.put( current, copy );
  
  			Instance parent = instanceToDuplicate.get( current.getParent());
  			if( parent != null )
  				insertChild( parent, copy );
  
  			toProcess.addAll( current.getChildren());
  		}
  
  		return instanceToDuplicate.get( instance );
  	}
docs: Replicates an instance and its children.
  <p>
  The result does not have any parent. It does not have any
  data and imports. In fact, only the name,
  the component association, the channel and the overridden exports
  are copied. The children are not "referenced" but replicated.
  </p>
  
  @param instance a non-null instance to replicate
  @return a non-null instance