Since you have nested classes, there is no shortcut to duplicate them at once. You can create new instance of the library class, but there's no way to create instance with all the added children inside.
Think of duplication as simple instantiation of a class. It will be the same as it is when you first created it. If it's empty at the beginning - it will be empty when you duplicate it.
So if you manually added Dick to Harry, then if you create new Harry it will be empty. You need another Dick instance to be added to the new Harry.
Just create a function like createHarry()
. There you instantiate all classes and add them one to each other as you want. Then return the latest Harry class and you are ready to go :)