Organizing IndexedDB code better