Extract common code from ModelBuilder::process()