Added validation for deleting messages.