public function updateInRelation() {
    $this->requireTransaction();
    $request = $this->getRequest();

    $isOrderRequest = $request->hasValue('referenceOid');
    $request->setValue('role', $request->getValue('relation'));
    if ($isOrderRequest) {
      // change order in a relation
      $request->setValue('containerOid', $request->getValue('sourceOid'));
      $request->setValue('insertOid', $request->getValue('targetOid'));

      // delegate to SortController
      $subResponse = $this->executeSubAction('insertBefore');
    }
    else {
      // update existing object
      // delegate to SaveController
      // NOTE: we need to update first, otherwise the update action might override
      // the foreign keys changes from the associate action
      $subResponse = $this->executeSubAction('update');
      if (!$subResponse->hasErrors()) {
        // and add object to relation
        // delegate to AssociateController
        $subResponse = $this->executeSubAction('associate');
      }
    }

    // add related object to subresponse similar to default update action
    if (!$subResponse->hasErrors()) {
      $targetOidStr = $request->getValue('targetOid');
      $targetOid = ObjectId::parse($targetOidStr);
      $persistenceFacade = $this->getPersistenceFacade();
      $targetObj = $persistenceFacade->load($targetOid);
      $subResponse->setValue('oid', $targetOid);
      $subResponse->setValue($targetOidStr, $targetObj);
    }

    // prevent commit
    if ($subResponse->hasErrors()) {
      $this->endTransaction(false);
    }
    $this->handleSubResponse($subResponse, $targetOidStr);
  }