Fix the repeated insertion of charts into the database.