Trying to implement caching of events in sqlite database