Fix the bug where the eventId is not written into the database.