refactor the add and modify group