[server][FaceRest] Generalize addHostgroupsMap() so that other methods can use it.