Adding code to split up the unread messages array into chunks of at most 100 messages and process a chunk at a time