Show last modified conversation on top

I’ve two separate data types; Conversation and Message. Each conversation contains list of messages. I want that whenever there is a new message in a conversation, it shows at the top of repeating group conversations just like in Whatsapp or Signal. I’ve tried Sort By Modified Date but it doesn’t seem to work. Any workaround to sole this?

Add a field date in conversation. Every time create new message do a modification on conversation date to the current date.
On repeating group sort the conversations by this date.

Great that works. Thanks!