Store statistics in database.