refactory function in group service and make new group service unit test