Abstracted the calculations themselves into a service and implemented a console command to recalculate everything in the database