protected function addCapability(array $capability_data, IOpenStackImplementation $implementation)
 {
     $validator = $this->validator_factory->buildValidatorForCapability($capability_data);
     if ($validator->fails()) {
         return $this->validationError($validator->messages());
     }
     $component = $this->component_repository->getById(intval($capability_data['component_id']));
     if (!$component) {
         throw new NotFoundEntityException('OpenStackComponent', sprintf('id %', intval($capability_data['component_id'])));
     }
     $release = $this->release_repository->getById(intval($capability_data['release_id']));
     if (!$release) {
         throw new NotFoundEntityException('OpenStackRelease', sprintf('id %', intval($capability_data['release_id'])));
     }
     if (!$release->supportsComponent($component->getCodeName())) {
         throw new NonSupportedComponent($release, $component);
     }
     $supported_version = null;
     if ($component->getSupportsVersioning()) {
         $version = $this->api_version_repository->getById(intval($capability_data['version_id']));
         if (!$version) {
             throw new NotFoundEntityException('OpenStackApiVersion', sprintf('id %', intval($capability_data['version_id'])));
         }
         $supported_version = $release->supportsApiVersion($version);
     } else {
         $supported_version = $this->supported_version_repository->getByReleaseAndComponentAndApiVersion(intval($capability_data['release_id']), intval($capability_data['component_id']), 0);
     }
     if (!$supported_version) {
         throw new NotFoundEntityException('OpenStackReleaseSupportedVersion', '');
     }
     $capability = $this->factory->buildCapability(intval($capability_data['coverage']), $supported_version, $implementation);
     $this->registerCapability($implementation, $capability);
 }