public function updateProperties(array $properties, $refresh = true)
    {
        if (empty($properties)) {
            throw new CmisInvalidArgumentException('Properties must not be empty!');
        }

        $objectId = $this->getId();
        $changeToken = $this->getChangeToken();

        $updatability = [];
        $updatability[] = Updatability::cast(Updatability::READWRITE);
        if ((boolean) $this->getPropertyValue(PropertyIds::IS_VERSION_SERIES_CHECKED_OUT) === true) {
            $updatability[] = Updatability::cast(Updatability::WHENCHECKEDOUT);
        }

        $newObjectId = $objectId;
        $this->getBinding()->getObjectService()->updateProperties(
            $this->getRepositoryId(),
            $newObjectId,
            $this->getObjectFactory()->convertProperties(
                $properties,
                $this->getObjectType(),
                (array) $this->getSecondaryTypes(),
                $updatability
            ),
            $changeToken
        );

        // remove the object from the cache, it has been changed
        $this->getSession()->removeObjectFromCache($this->getSession()->createObjectId($objectId));

        if ($refresh === true) {
            $this->refresh();
        }

        if ($newObjectId === null) {
            return null;
        }

        return $this->getSession()->getObject(
            $this->getSession()->createObjectId($newObjectId),
            $this->getCreationContext()
        );
    }