Ensure groups are sorted by its roles dependency and nodes in a group are sorted by name in the REST API response