same_message is a confusing name, cause there is messages that are ContentData object.
Consider to rename it to is_same_message, cause this name intends to boolean.
or move check to the "if", one line beneath.