Create a new output based on a existing cluster output in VS

Hi all,

is there a better way to get the cluster output and just duplicate the content to a new output without checking
the data structure and iterating over it and fill the new one in visual studio.

example of the “not so good” way.

           string Path = "None";                      
            GH_Cluster Cluster = new GH_Cluster();
            Cluster.CreateFromFilePath(Path);
            List<IGH_Param> ClusterOutput = Cluster.Params.Output;



            for (int i = 0; i < ClusterOutput.Count; i++)
            {
                // check what kind of output has the existing output (item,list,tree)
                if (ClusterOutput[i].Access == GH_ParamAccess.tree)
                {
                    // create a new tree iterate over the existing cluster output tree and fill the new one
                    GH_Structure<IGH_Goo> str = new GH_Structure<IGH_Goo>();
                    foreach (GH_Path p in ClusterOutput[i].VolatileData.Paths)
                    {
                        List<IGH_Goo> l = new List<IGH_Goo>();
                        foreach (IGH_Goo item in ClusterOutput[i].VolatileData.get_Branch(p))
                        {
                            if (item is null)
                            {
                                l.Add(null);
                            }
                            else
                            {
                                l.Add(item);
                            }
                        }
                    }
                    DA.SetDataTree(i, str);
                }
            }
        }