First version of database saving that runs without crashing

Although, probably not correct
Fix file version number.
Rethrow expection instead of ignoring it.
Fix enryption direction.