calculate id for group while adding new child