class DockerRegistryManager implements SecuredEntityManager {

    @Transactional(propagation = Propagation.REQUIRED)
    public DockerRegistry delete(Long id, boolean force) {
        DockerRegistry registry = dockerRegistryDao.loadDockerRegistry(id);
        if (force) {
            //remove all tools from registry to avoid DataIntegrityViolationException
            // But do not delete actual tools from registry
            toolGroupManager.loadByRegistryId(id).forEach(g -> toolGroupManager.delete(g.getId().toString(), force));
        }
        if (StringUtils.isNotBlank(registry.getSecretName())) {
            kubernetesManager.deleteSecret(registry.getSecretName());
        }
        dockerRegistryDao.deleteDockerRegistry(id);
        return registry;
    }

}