Clean up low-level database access and data sync