@SuppressWarnings("unchecked")
  protected void link(final Any<?> any, final Boolean unlink) {
    AnyPatch patch = newPatch(any.getKey());
    patch
        .getResources()
        .add(
            new StringPatchItem.Builder()
                .operation(unlink ? PatchOperation.DELETE : PatchOperation.ADD_REPLACE)
                .value(profile.getTask().getResource().getKey())
                .build());

    update(patch);
  }
  protected void assign(final Any<?> any, final Boolean enabled) {
    AnyPatch patch = newPatch(any.getKey());
    patch
        .getResources()
        .add(
            new StringPatchItem.Builder()
                .operation(PatchOperation.ADD_REPLACE)
                .value(profile.getTask().getResource().getKey())
                .build());

    update(patch);

    provision(any, enabled);
  }
  @SuppressWarnings("unchecked")
  protected void unassign(final Any<?> any) {
    AnyPatch patch = newPatch(any.getKey());
    patch
        .getResources()
        .add(
            new StringPatchItem.Builder()
                .operation(PatchOperation.DELETE)
                .value(profile.getTask().getResource().getKey())
                .build());

    update(patch);

    deprovision(any);
  }