public Mono<Long> countRelationships(
            @Nullable Set<Long> ownerIds,
            @Nullable Set<Long> relatedUserIds,
            @Nullable Set<Integer> groupIndexes,
            @Nullable Boolean isBlocked) {
        boolean queryByGroupIndexes = groupIndexes != null;
        boolean queryByRelationshipInfo = relatedUserIds != null || isBlocked != null;
        if (queryByGroupIndexes && queryByRelationshipInfo) {
            if (relatedUserIds != null && relatedUserIds.isEmpty()) {
                return Mono.just(0L);
            }
            Recyclable<Set<Long>> recyclableSet = SetRecycler.obtain();
            return userRelationshipGroupService
                    .queryRelationshipGroupMemberIds(ownerIds, groupIndexes, null, null)
                    .collect(Collectors.toCollection(recyclableSet::getValue))
                    .flatMap(userIds -> {
                        if (relatedUserIds != null) {
                            userIds.retainAll(relatedUserIds);
                        }
                        return countRelationships(ownerIds, userIds, isBlocked);
                    })
                    .doFinally(signalType -> recyclableSet.recycle());
        } else if (queryByGroupIndexes) {
            return userRelationshipGroupService.countRelationshipGroupMembers(ownerIds,
                    groupIndexes);
        }
        return countRelationships(ownerIds, relatedUserIds, isBlocked);
    }
@return true if the relationship existed and has been deleted;
        <p>
        false if the relationship does not exist, or still exists and has been deleted from a
        relationship group.
turms-service/src/main/java/im/turms/service/domain/user/service/UserRelationshipService.java