Refactored dump and restore methods
Added unit tests for dump and restore methods