private Mono<MessageAndRecipientIds> saveMessage0(
            boolean queryRecipientIds,
            @Nullable Boolean persist,
            @Nullable Long messageId,
            @NotNull Long senderId,
            @Nullable byte[] senderIp,
            @NotNull Long targetId,
            @NotNull Boolean isGroupMessage,
            @NotNull Boolean isSystemMessage,
            @Nullable String text,
            @Nullable List<byte[]> records,
            @Nullable @Min(0) Integer burnAfter,
            @Nullable @PastOrPresent Date deliveryDate,
            @Nullable Long referenceId,
            @Nullable Long preMessageId) {
        Mono<Set<Long>> queryRecipients;
        if (queryRecipientIds) {
            queryRecipients = isGroupMessage
                    ? groupMemberService.queryGroupMemberIds(targetId, true)
                            .map(memberIds -> CollectionUtil.remove(memberIds, senderId))
                    : Mono.just(Set.of(targetId));
        } else {
            queryRecipients = PublisherPool.EMPTY_SET;
        }
        return queryRecipients.flatMap(recipientIds -> {
            boolean save = persist == null
                    ? persistMessage
                    : persist;
            if (!save) {
                return recipientIds.isEmpty()
                        ? Mono.empty()
                        : Mono.just(new MessageAndRecipientIds(null, recipientIds));
            }
            return saveMessage(messageId,
                    senderId,
                    senderIp,
                    targetId,
                    isGroupMessage,
                    isSystemMessage,
                    text,
                    records,
                    burnAfter,
                    deliveryDate,
                    null,
                    referenceId,
                    preMessageId).map(message -> {
                        if (message.getId() != null && sentMessageCache != null) {
                            cacheSentMessage(message);
                        }
                        return new MessageAndRecipientIds(message, recipientIds);
                    });
        });
    }
@return {@link reactor.core.publisher.MonoEmpty} if {@link MessageProperties#persistMessage}
        is false and no recipient.
        <p>
        {@link MessageAndRecipientIds#message} is null if
        {@link MessageProperties#persistMessage} is false.
turms-service/src/main/java/im/turms/service/domain/message/service/MessageService.java