deleting messages by thread id can lead to race conditions where a new sms comes in just at this moment. the current code is not really better though, I think we could have a filter with thread id + a "latest timestamp" that would be the moment that the user clicked on the "edit" button.