BK-1062 Duplicated code for joining/leaving groups