TODO: Why do we have this as a separate call?
We should add this to handle().

@param string $owner_type
@param int    $owner_id

@throws \Exception
342695
private function updateAttendees(string $owner_type, int $owner_id)
    {

        CharacterCalendarEventDetail::where('owner_id', $owner_id)
            ->where('owner_type', $owner_type)
            ->get()->each(function ($event) {

                $attendees = $this->retrieve([
                    'character_id' => $this->getCharacterId(),
                    'event_id'     => $event->event_id,
                ]);

                if ($attendees->isCachedLoad()) return;

                collect($attendees)->each(function ($attendee) use ($event) {

                    CharacterCalendarAttendee::firstOrNew([
                        'character_id' => $attendee->character_id,
                        'event_id'     => $event->event_id,
                    ])->fill([
                        'event_response' => $attendee->event_response,
                    ])->save();

                });

                CharacterCalendarAttendee::where('event_id', $event->event_id)
                    ->whereNotIn('character_id', collect($attendees)
                        ->pluck('character_id')->flatten()->all())
                    ->delete();
            });
    }
691543
public function groupTransfer($group_id, $new_owner_user)
    {
        $url          = $this->url.'chatgroups/'.$group_id;
        $option       = [
            'newowner' => $new_owner_user
        ];
        $access_token = $this->getToken();
        $header []    = 'Authorization: Bearer '.$access_token;

        return Http::postCurl($url, $option, $header, 'PUT');
    }
692378
public function setOwner($type, $id)
    {
        $this->ownerType = $type;
        $this->ownerId = $id;

        $this->server->getEventEmitter()->emit(new SessionOwnerEvent($this));

        return $this;
    }
209304
public static function fromOwnerAndName(string $owner, string $name): self
    {
        if (1 !== \preg_match(self::ownerRegEx(), $owner)) {
            throw new Exception\InvalidArgumentException(\sprintf(
                'Owner "%s" does not appear to be a valid owner.',
                $owner
            ));
        }

        if (1 !== \preg_match(self::nameRegEx(), $name)) {
            throw new Exception\InvalidArgumentException(\sprintf(
                'Name "%s" does not appear to be a valid name.',
                $name
            ));
        }

        return new self(
            $owner,
            $name
        );
    }
1203876
protected function morphEagerTo($name, $type, $id, $ownerKey)
    {
        return $this->newMorphTo(
            $this->newQuery()->setEagerLoads([]), $this, $id, $ownerKey, $type, $name
        );
    }
1258822
public function setOwner(HTML_QuickForm2_Node $owner)
    {
        if (!$owner instanceof HTML_QuickForm2_Element_InputFile) {
            throw new HTML_QuickForm2_InvalidArgumentException(
                'MimeType Rule can only validate file upload fields, '.
                get_class($owner) . ' given'
            );
        }
        parent::setOwner($owner);
    }
59823
public void setOwner(ListenerOwner owner)
    {
        super.setOwner(owner);
        if (this.getOwner() != null)
        {
            if (m_fldTarget.getRecord() != this.getOwner().getRecord())
                m_fldTarget.getRecord().addListener(new FileRemoveBOnCloseHandler(this));   // Not same file, if target file closes, remove this listener!
        }
    }
48647
public static void addSuppressed(Throwable owner, Throwable add) {
		try {
			Method method = owner.getClass().getMethod("addSuppressed", Throwable.class);
			method.invoke(owner, add);
		} catch (NoSuchMethodException e) {
			// ignore, will happen for JRE < 1.7
		} catch (SecurityException e) {
			throwUncheckedException(e);
		} catch (IllegalAccessException e) {
			throwUncheckedException(e);
		} catch (IllegalArgumentException e) {
			throwUncheckedException(e);
		} catch (InvocationTargetException e) {
			throwUncheckedException(e);
		}
	}
226009
public function viewAction($owner, $ownerId)
    {
        /** @var BlockProviderInterface $provider */
        $provider = $this->get('opifer.content.block_provider_pool')->getProvider($owner);
        $object = $provider->getBlockOwner($ownerId);

        /** @var Environment $environment */
        $environment = $this->get('opifer.content.block_environment');
        $environment->setDraft(true)->setObject($object);
        $environment->setBlockMode('manage');

        return $this->render($environment->getView(), $environment->getViewParameters());
    }
1288749
public function upCall($type, $args = array())
    {
        /*
         * Try to handle something on our own and in case we are not able,
         * pass to parent. Such as messages, notifications and request for
         * additional info or descriptions are passed this way.
         */
        if (method_exists($this, $type)) {
            return call_user_func_array(
                array(
                    $this,
                    $type,
                ),
                $args
            );
        }
        if (!$this->owner) {
            return false;
        }

        return $this->owner->upCall($type, $args);
    }
936824
public function createBlock($ownerId, $type, $parentId, $placeholder, $sort, $data = null)
    {
        $owner = $this->find($ownerId);
        $version = $this->getNewVersion($owner);
        $className = $this->em->getClassMetadata($type)->getName();
        $block = new $className();
        $parent = $this->find($parentId ?: $ownerId);

        $block->setRootVersion($version);
        $block->setPosition($placeholder);
        $block->setSort(0); // < default, gets recalculated later for entire level
        $block->setLevel(0); // < need to be calculated when putting in the tree

        // Set owner
        $block->setOwner($owner);
        $owner->addOwning($block);
        $owner->setRootVersion($version);

        // This should replaced with a more hardened function
        if ($data) {
            foreach ($data as $attribute => $value) {
                $method = "set$attribute";
                $block->$method($value);
            }
        }

        $block->setParent($parent);
        $parent->setRootVersion($version);

        // Save now, rest will be in changeset. All we do is a create a stub entry anyway.
        $this->save($block);

        if (count($sort) > 1) {
            // Replace the zero value in the posted sort array
            // with the newly created id to perform sorting
            $id = $block->getId();
            $sort = array_map(
                function ($v) use ($id) {
                    return $v == "" || $v == "0" ? $id : $v;
                },
                $sort
            );

            $siblings = $this->getSiblings($block, $version);
            $siblings[] = $block;
            if ($siblings) {
                $siblings = $this->sortBlocksByDirective($siblings, $sort);

                foreach ($siblings as $sibling) {
                    $this->save($sibling);
                }
            }
        } else {
        }

        return $block;
    }
799311
private function executePrivilege($type, $privilege, $username, $database = null)
    {

        if (!in_array($privilege, [self::PRIVILEGE_READ, self::PRIVILEGE_WRITE, self::PRIVILEGE_ALL], true)) {
            throw new Exception($privilege . ' is not a valid privileges, allowed privileges: READ, WRITE, ALL');
        }

        if ($privilege !== self::PRIVILEGE_ALL && !$database) {
            throw new Exception('Only grant ALL cluster-wide privileges are allowed');
        }

        $database = ($database instanceof Database ? $database->getName() : (string) $database);

        $query = "$type $privilege";

        if ($database) {
            $query .= sprintf(' ON %s ', $database);
        } else {
            $query .= ' PRIVILEGES ';
        }

        if ($username && $type === 'GRANT') {
            $query .= "TO $username";
        } elseif ($username && $type === 'REVOKE') {
            $query .= "FROM $username";
        }

        return $this->client->query(null, $query);
    }
55789
public function setOwner(HTML_QuickForm2_Node $owner)
    {
        if (null !== $this->owner) {
            $this->owner->removeRule($this);
        }
        $this->owner = $owner;
    }
1191768
@Override
    @Path("/{ownerType}/{ownerId}")
    @ApiOperation(value="Update attributes for an ownerType and ownerId", response=StatusMessage.class)
    @ApiImplicitParams({
        @ApiImplicitParam(name="Attributes", paramType="body", required=true, dataType="java.lang.Object")})
    public JSONObject put(String path, JSONObject content, Map<String,String> headers)
    throws ServiceException, JSONException {
        String ownerType = getSegment(path, 1);
        if (ownerType == null)
            throw new ServiceException(ServiceException.BAD_REQUEST, "Missing pathSegment: ownerType");
        String ownerId = getSegment(path, 2);
        if (ownerId == null)
            throw new ServiceException(ServiceException.BAD_REQUEST, "Missing pathSegment: ownerId");

        try {
            Map<String,String> attrs = JsonUtil.getMap(content);
            ServiceLocator.getWorkflowServices().updateAttributes(ownerType, Long.parseLong(ownerId), attrs);
            return null;
        }
        catch (NumberFormatException ex) {
            throw new ServiceException(ServiceException.BAD_REQUEST, "Invalid ownerId: " + ownerId);
        }
        catch (JSONException ex) {
            throw new ServiceException(ServiceException.INTERNAL_ERROR, ex.getMessage(), ex);
        }
    }
1097255
public function withOwner($owner, callable $callback, $args = [])
    {
        try {
            $this->setOwner($owner);
            return $callback(...$args);
        } finally {
            $this->clearOwner();
        }
    }
922081
public function indexAccount($user_id)
    {
        $this->setUserAccount($user_id);
        $this->setTitleIndexAccount();
        $this->setBreadcrumbIndexAccount();

        $this->setFilter();
        $this->setPagerOrderIndexAccount();

        $this->setData('user', $this->data_user);
        $this->setData('orders', $this->getListOrderAccount());

        $this->outputIndexAccount();
    }
1278258
public function setOwner(\WobbleCode\UserBundle\Document\User $owner)
    {
        $this->owner = $owner;
        return $this;
    }