Add the sequence number in the sync table and use that instead of

inferring the sequence number depending on the amount of messages in the
table.
Fix the multiple range behavior to only send back the messages
actually contained between the set of ranges.
Fix the tests to check for the correct behavior.