Got rid of a lot of duplication in SqlitePersistence.py