Recreates the groups master list based on the groups hierarchy (order matters here,
        since the parser uses order to determine lineage).

def _rebuild_groups(self):
        """
        Recreates the groups master list based on the groups hierarchy (order matters here,
        since the parser uses order to determine lineage).
        """
        self.groups = []
        
        def collapse_group(group):
            for subgroup in group.children:
                self.groups.append(subgroup)
                collapse_group(subgroup)
                
        collapse_group(self.root)