change this to only reinsert parent groups. 

```sql
INSERT INTO `cohort_master_group` (`cohort_id`,`group_id`) SELECT `cohort_id`, `group_id` FROM `group` ORDER BY `group_id` WHERE `cohort_id` IS NOT NULL AND `parent_group_id` IS NULL;
```