Move persistence code to own namespace / file

Just starting to learn about namespaces and trying to get my head
around proper encapsulation patterns.