Implement offline-first IndexedDB logic