private JsonObject replaceResourceIdentity(String conversationBody, ResourceDescriptor targetResource) {
        JsonObject conversation = new JsonObject(conversationBody);
        ResourceDescriptor folderLink = targetResource.getParent();
        String folderUrl = folderLink == null
                ? targetResource.getType().group() + ResourceDescriptor.PATH_SEPARATOR + targetResource.getBucketName()
                : folderLink.getDecodedUrl();
        if (folderUrl.charAt(folderUrl.length() - 1) == '/') {
            folderUrl = folderUrl.substring(0, folderUrl.length() - 1);
        }
        // id and folderId are chat specific
        conversation.put("id", targetResource.getDecodedUrl());
        conversation.put("folderId", folderUrl);
        return conversation;
    }
Replaces conversation identity and attachment links after it has been copied from one location to another.
Replacing `id` and `folderId` - chat specific and may not be suitable for generic use-case.
Typical use-case: replace attachment links in conversation after publishing.

@param conversationBody   - source conversation body
@param targetResource     - target resource link
@param attachmentsMapping - attachments map (sourceUrl -> targetUrl) to replace
@return conversation body after replacement
server/src/main/java/com/epam/aidial/core/server/service/PublicationUtil.java