Are you fine with this type of calculating the next free id_group or should I move it to the function and rename that function to getNextGroupID() ?