Implemented the persistence and archiving

Added some tests for both