Unique the list of groups before iterating over them