protected function getResourceDefinitionName(ResourceDefinition $resourceDefinition)
    {
        $resourceDefinitionClassName = get_class($resourceDefinition);
        if (!isset($this->resourceDefinitionNames[$resourceDefinitionClassName])) {

            $prettyName = $this->entityNameLibrary->toPretty($resourceDefinition->getEntityClassName());
            $name = $prettyName;

            // check if this name is already in use
            $counter = 1;
            while (in_array($name, $this->resourceDefinitionNames)) {
                $counter ++;
                $name = $prettyName . $counter;
            }

            $this->resourceDefinitionNames[$resourceDefinitionClassName] = $name;
        }

        return $this->resourceDefinitionNames[$resourceDefinitionClassName];
    }