Made persistence library templated