Add a database insertion function that reuses the old average value to create a new one.