Refactoring serialization/deserialization of registry and dependency graph