You can make all these objects global, then when player selects a group of objects, destroy all other objects and change layout. Remaining objects will be transferred to the new layout.
Alternatively, you need to save the list of selected objects in an array/dictionary and then re-create them in the new layout from the saved data.
Read about families and containers, they may make the job much easier.