private cgSearch storeParsedCaches(Collection<cgCache> caches) { final cgSearch search = new cgSearch(); final cgeoapplication app = cgeoapplication.getInstance(); int storedCaches = 0; for (cgCache cache : caches) { // remove from cache because a cache might be re-imported app.removeCacheFromCache(cache.getGeocode()); app.addCacheToSearch(search, cache); if (progressHandler.isCancelled()) { throw new CancellationException(); } progressHandler.sendMessage(progressHandler.obtainMessage(0, ++storedCaches, 0)); } return search; }