Save metrics in database