code: private String safeApply( Collection<InstanceContextBean> instances, Options options, String componentPath )
  	throws IOException {
  
  		// Parse the filter.
  		String installerName = (String) options.hash.get( "installer" );
  		final InstanceFilter filter = InstanceFilter.createFilter( componentPath, installerName );
  
  		// Apply the filter.
  		final Collection<InstanceContextBean> selectedInstances = filter.apply( instances );
  
  		// Apply the content template of the helper to each selected instance.
  		final StringBuilder buffer = new StringBuilder();
  		final Context parent = options.context;
  		int index = 0;
  		final int last = selectedInstances.size() - 1;
  
  		for( final InstanceContextBean instance : selectedInstances ) {
  			final Context current = Context.newBuilder( parent, instance )
  					.combine( "@index", index )
  					.combine( "@first", index == 0 ? "first" : "" )
  					.combine( "@last", index == last ? "last" : "" )
  					.combine( "@odd", index % 2 == 0 ? "" : "odd" )
  					.combine( "@even", index % 2 == 0 ? "even" : "" )
  					.build();
  
  			index++;
  			buffer.append( options.fn( current ));
  		}
  
  		return buffer.toString();
  	}
docs: Same as above, but with type-safe arguments.
  
  @param instances the instances to which this helper is applied.
  @param options   the options of this helper invocation.
  @return a string result.
  @throws IOException if a template cannot be loaded.