code: public static boolean tryToInsertChildInstance( AbstractApplication application, Instance parentInstance, Instance childInstance ) {
  
  		// First, make sure there is no child instance with this name before inserting.
  		// Otherwise, removing the child instance may result randomly.
  		boolean hasAlreadyAChildWithThisName = hasChildWithThisName( application, parentInstance, childInstance.getName());
  
  		// We insert a "root instance"
  		boolean success = false;
  		if( parentInstance == null ) {
  			if( ! hasAlreadyAChildWithThisName
  					&& ComponentHelpers.findAllAncestors( childInstance.getComponent()).isEmpty()) {
  
  				application.getRootInstances().add( childInstance );
  				success = true;
  				// No validation here, but maybe we should...
  			}
  		}
  
  		// We insert a child instance
  		else {
  			if( ! hasAlreadyAChildWithThisName
  					&& ComponentHelpers.findAllChildren( parentInstance.getComponent()).contains( childInstance.getComponent())) {
  
  				InstanceHelpers.insertChild( parentInstance, childInstance );
  				Collection<Instance> allInstances = InstanceHelpers.getAllInstances( application );
  				Collection<ModelError> errors = RuntimeModelValidator.validate( allInstances );
  				if( RoboconfErrorHelpers.containsCriticalErrors( errors )) {
  					parentInstance.getChildren().remove( childInstance );
  					childInstance.setParent( null );
  
  				} else {
  					success = true;
  				}
  			}
  		}
  
  		return success;
  	}
docs: Tries to insert a child instance.
  <ol>
  <li>Check if there is no child instance with this name.</li>
  <li>Check that the graph(s) allow it (coherence with respect to the components).</li>
  <li>Insert the instance.</li>
  <li>Validate the application after insertion.</li>
  <li>Critical error =&gt; revert the insertion.</li>
  </ol>
  <p>
  This method assumes the application is already valid before the insertion.
  Which makes sense.
  </p>
  
  @param application the application (not null)
  @param parentInstance the parent instance (can be null)
  @param childInstance the child instance (not null)
  @return true if the child instance could be inserted, false otherwise