public Mono<Void> moveRelatedUserToNewGroup(
            @NotNull Long ownerId,
            @NotNull Long relatedUserId,
            @NotNull Integer currentGroupIndex,
            @NotNull Integer targetGroupIndex,
            boolean suppressIfAlreadyExistsInTargetGroup,
            @Nullable ClientSession session) {
        try {
            Validator.notNull(ownerId, "ownerId");
            Validator.notNull(relatedUserId, "relatedUserId");
            Validator.notNull(currentGroupIndex, "currentGroupIndex");
            Validator.notNull(targetGroupIndex, "targetGroupIndex");
        } catch (ResponseException e) {
            return Mono.error(e);
        }
        if (currentGroupIndex.equals(targetGroupIndex)) {
            return Mono.empty();
        }
        UserRelationshipGroupMember.Key key =
                new UserRelationshipGroupMember.Key(ownerId, currentGroupIndex, relatedUserId);
        UserRelationshipGroupMember.Key newKey =
                new UserRelationshipGroupMember.Key(ownerId, targetGroupIndex, relatedUserId);
        Mono<Void> insert = userRelationshipGroupMemberRepository
                .insert(new UserRelationshipGroupMember(newKey, new Date()), session);
        if (suppressIfAlreadyExistsInTargetGroup) {
            insert = insert.onErrorComplete(DuplicateKeyException.class);
        }
        return insert.then(userRelationshipGroupMemberRepository.deleteById(key, session))
                .then(userVersionService.updateRelationshipGroupsVersion(ownerId)
                        .onErrorResume(t -> {
                            LOGGER.error(
                                    "Caught an error while updating the relationship groups version of the owner ({}) after moving a user to a new group",
                                    ownerId,
                                    t);
                            return Mono.empty();
                        }))
                .then();
    }
@return true if added a new related user to the relationship group.
@implNote We call this method while upserting a relationship into the owner's relationship
          group in a transaction currently, so we don't check whether the owner has a
          relationship with the related user in this method.
turms-service/src/main/java/im/turms/service/domain/user/service/UserRelationshipGroupService.java