storing next message ID in separate table - clear history will otherwise reset the next message ID