Refactoring persistence and integration tests