How do I assign media to cloned sections?

In my template, I have one section and two different medias (media 1 and 2).
The goal is to create a second copy of the section, so I would use a control script for this and clone the section. Now the end user wants me to assign media 1 to the first copy and media 2 to the second copy. How would this be done?
I attempted a control script but not sure if it works:

//use cloning a section to create a second copy to print
var clone = printSections["Section 1"].clone();
printSections["Section 1"].addAfter(clone);

//set up variables to represent the different media types in the template
var Plain = merge.template.media["Media 1"];
var Letterhead = merge.template.media["Media 2"];

//assign each section its own media
printSections["Section 1"].sheetConfig.positions.all.media = Plain;
clone.sheetConfig.positions.all.media = Letterhead;

You r logic seems sound, however I would define the medias using the UI as to not bring confusion. Also, I would define the media of the clone before adding the clone. Something like this:

var clone = printSections["Section 1"].clone();
clone.sheetConfig.positions.all.media = Letterhead;
printSections["Section 1"].addAfter(clone);

Can you confirm this works for you?