IObject updated = gateway.updateObject(annotatedObject.asIObject(), options);
IObject object = annotatedObject.asIObject(); ModelMapper.unloadCollections(object); IObject updated = gateway.updateObject(object, options);
    public DataObject updateAnnotationFor(DataObject annotatedObject,                                          AnnotationData data)            throws DSOutOfServiceException, DSAccessException    {        if (data == null)             throw new IllegalArgumentException("No annotation to update.");        if (annotatedObject == null)             throw new IllegalArgumentException("No annotated DataObject.");        if (!(annotatedObject instanceof ImageData) &&                 !(annotatedObject instanceof DatasetData))            throw new IllegalArgumentException("This method only supports " +                    "ImageData and DatasetData objects.");        Map options = (new PojoOptions()).map();        IObject updated = gateway.updateObject(annotatedObject.asIObject(),                                                options);        IObject toUpdate = data.asIObject();        ModelMapper.setAnnotatedObject(updated, toUpdate);        gateway.updateObject(toUpdate, options);        return PojoMapper.asDataObject(updated);    }