Move preferences retrieval to its own repository

Still not functional, needs a new 'time' column on the prefs schema to
make the UPDATE actually work