@Override
    protected void doCommand() {
        final Set<String> geocodesList = cacheList.isEmpty() ? DataStore.getBatchOfStoredCaches(null, listId).getGeocodes() : cacheList;

        final Set<Geocache> caches = DataStore.loadCaches(geocodesList, LoadFlags.LOAD_CACHE_OR_DB);

        for (final Geocache geocache : caches) {
            final HashSet<Integer> backupOfLists = new HashSet<>(geocache.getLists());
            final String geocode = geocache.getGeocode();
            // remove the current list, since that will ease the undo operation
            backupOfLists.remove(listId);
            oldLists.put(geocode, backupOfLists);
        }

        final List<StoredList> lists = DataStore.getLists();
        for (final StoredList list : lists) {
            if (list.id == listId) {
                continue;
            }
            DataStore.removeFromList(caches, list.id);
        }
    }
Removes the caches of the selected list from all other lists.
main/src/main/java/cgeo/geocaching/command/MakeListUniqueCommand.java