public static void saveLists(final Collection<Geocache> caches, final Set<Integer> listIds) {
        if (caches.isEmpty()) {
            return;
        }
        withAccessLock(() -> {

            init();

            final SQLiteStatement add = PreparedStatement.ADD_TO_LIST.getStatement();
            final SQLiteStatement remove = PreparedStatement.REMOVE_FROM_ALL_LISTS.getStatement();

            database.beginTransaction();
            try {
                for (final Geocache cache : caches) {
                    remove.bindString(1, cache.getGeocode());
                    remove.execute();
                    cache.getLists().clear();

                    for (final Integer listId : listIds) {
                        final AbstractList list = AbstractList.getListById(listId);
                        if (list == null) {
                            return;
                        }
                        if (!list.isConcrete()) {
                            return;
                        }
                        add.bindLong(1, listId);
                        add.bindString(2, cache.getGeocode());
                        add.execute();

                        cache.getLists().add(listId);
                    }
                }
                database.setTransactionSuccessful();
            } finally {
                database.endTransaction();
            }
        });
    }
@param listId  List to change
@param prevent value
@return Number of lists changed
main/src/main/java/cgeo/geocaching/storage/DataStore.java