Would there be any value in prefixing the threadkey with the messagebox id and using it as the message id? This would avoid all of the threadkey-->message/created lookups.