Move persistence related functions to their own module.
Separate out libcgroup based functionality and add configurable templates.