save stats in the db