public function getRelatedObject($baseObject, $baseRole, $primaryRelation = null)
    {
        $companionRole = $this->companionRole($baseRole);
        $companionType = $this->companionRoleType($baseRole);
        $companionModel = $companionType->primaryModel;
        if (!isset($primaryRelation) || is_array($primaryRelation)) {
            if (!is_array($primaryRelation)) {
                $primaryRelation = [];
            }
            $primaryRelation = $this->getPrimaryRelation($baseObject, $baseRole, $primaryRelation);
        }
        if (!empty($primaryRelation)) {
            if ($companionRole === 'child') {
                return $primaryRelation->childObject;
            } else {
                return $primaryRelation->parentObject;
            }
        }

        return false;
    }