static getMessagesForConversation(messages, parentMessageId) {
        const orderedMessages = [];
        let currentMessageId = parentMessageId;
        while (currentMessageId) {
            // eslint-disable-next-line no-loop-func
            const message = messages.find(m => m.id === currentMessageId);
            if (!message) {
                break;
            }
            orderedMessages.unshift(message);
            currentMessageId = message.parentMessageId;
        }

        return orderedMessages;
    }
Iterate through messages, building an array based on the parentMessageId.
Each message has an id and a parentMessageId. The parentMessageId is the id of the message that this message is a reply to.
@param messages
@param parentMessageId
@returns {*[]} An array containing the messages in the order they should be displayed, starting with the root message.