Moved database management from OfflineLayer to ImageStore