@Override
        public Object replace(final Object key, final GeoPrimitive oldValue, final Object oldContext, final GeoPrimitive newValue) {
            Log.d(this.logPraefix + "REPLACE '" + key + "'");
            replaceProcessed++;
            replaceProcessedInBatch++;

            //check validity of old and new value.
            //If one of them is invalid, replacement has to handled as add or remove instead
            final boolean oldIsValid = GeoItem.isValid(oldValue);
            final boolean newIsValid = GeoItem.isValid(newValue);
            if (oldIsValid && newIsValid) {
                return providerLayer.replace(oldValue, oldContext, newValue);
            }
            if (oldIsValid) {
                providerLayer.remove(oldValue, oldContext);
                return null;
            }
            if (newIsValid) {
                return providerLayer.add(newValue);
            }
            return null;
        }
Key class to be used for entries in MapWriter from a GeoGroup
main/src/main/java/cgeo/geocaching/unifiedmap/geoitemlayer/GeoItemLayer.java