ledger: save method with backup
Split code in several functions