private void updateRelatedObjectSet(APIPatch.Operation operation,
            RelatedObjectSetPatch relatedObjectSetPatch, String identifier)
            throws GuacamoleException {

        // Add or remove object based on operation
        switch (operation) {

            // Add object
            case add:
                relatedObjectSetPatch.addObject(identifier);
                break;

            // Remove object
            case remove:
                relatedObjectSetPatch.removeObject(identifier);
                break;

            // Unsupported patch operation
            default:
                throw new GuacamoleClientException("Unsupported patch operation: \"" + operation + "\"");

        }

    }
Updates the given RelatedObjectSetPatch by queuing an add or remove
operation for the object having the given identifier based on the given
patch operation.

@param operation
    The patch operation to perform.

@param relatedObjectSetPatch
    The RelatedObjectSetPatch being modified.

@param identifier
    The identifier of the object being added or removed from the set.

@throws GuacamoleException
    If the requested patch operation is not supported.
guacamole/src/main/java/org/apache/guacamole/rest/identifier/RelatedObjectSetResource.java