@Override
    public void render(Value value, Object target, Class clazz, CoderContext context) throws ConversionException {
        if (target instanceof Map) {
            if (Map.class.isAssignableFrom(clazz)) {
                Map map = (Map) target;
                for (;;) {
                    if (!value.hasMoreItems()) {
                        break;
                    }
                    Object itemKey = value.get(null, context);
                    if (!value.hasMoreItems()) {
                        throw new ConversionException("Encoded Map entry has missing value");
                    }
                    Object itemValue = value.get(null, context);
                    map.put(itemKey, itemValue);
                }
            } else
                throw new ConversionException("Cannot convert a " + clazz.getName() + " to a Map");
        } else if (target instanceof Collection) {
            if (Collection.class.isAssignableFrom(clazz)) {
                Collection collection = (Collection) target;
                for (;;) {
                    if (!value.hasMoreItems()) {
                        break;
                    }
                    Object itemValue = value.get(null, context);
                    collection.add(itemValue);
                }
            } else
                throw new ConversionException("Cannot convert " + clazz.getName() + " to a Collection");

        } else
            throw new ConversionException("CollectionValueCoder cannot render to an object of class "
                    + target.getClass().getName());
    }