protected function getNextVersion($resourceId) {
        $candidate = 0;
        foreach ($this->getRevisions($resourceId) as $revision) {
            $version = $revision->getVersion();
            if (is_numeric($version) && $version > $candidate) {
                $candidate = $version;
            }
        }
        return $candidate + 1;
    }