private static void assertCacheExists(final Context context, final String geocode, @Nullable final String name, @Nullable final String description, final int assignedEmoji, @Nullable final Geopoint geopoint, final int listId) {
        if (DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_OR_DB) == null) {

            int newListId = listId;
            if (listId == UDC_LIST) {
                newListId = getUdcListId(context);
            }

            // create new cache
            final Geocache cache = new Geocache();
            cache.setGeocode(geocode);
            cache.setName(StringUtils.isEmpty(name) ? String.format(context.getString(R.string.internal_cache_default_names), geocode) : name);
            cache.setOwnerDisplayName(context.getString(R.string.internal_cache_default_owner));
            cache.setDescription(StringUtils.isEmpty(description) ? context.getString(R.string.internal_cache_default_description) : description);
            cache.setAssignedEmoji(assignedEmoji);
            cache.setDetailed(true);
            cache.setType(CacheType.USER_DEFINED);
            final Set<Integer> lists = new HashSet<>(1);
            lists.add(StoredList.getConcreteList(newListId));
            cache.setLists(lists);
            if (geopoint != null) {
                cache.setCoords(geopoint);
            }
            // add more fields if needed

            DataStore.saveCache(cache, EnumSet.of(LoadFlags.SaveFlag.DB));
        }
    }
creates a new cache with the given id, if it does not exist yet

@param context       context in which this function gets called
@param geocode       internal id of the cache
@param name          cache's name (or null for default name)
@param description   cache's description (or null for default description)
@param assignedEmoji cache's assigned emoji (or 0 for default cache type icon)
@param geopoint      cache's current location (or null if none)
@param listId        cache list's id, may be NEW_LIST
main/src/main/java/cgeo/geocaching/connector/internal/InternalConnector.java