retainAllMessages

Retains only the messages with the specified messageIds. Removes the remaining messages.