class ComponentConfigProviderService {

    public void replaceImageComponentWithNew(Component component) {
        Component componentEntity = componentRepository.findComponentByStackIdComponentTypeName(component.getStack().getId(), component.getComponentType(),
                component.getName()).orElseThrow(NotFoundException.notFound("component", component.getName()));
        componentEntity.setAttributes(component.getAttributes());
        componentEntity.setName(component.getName());
        componentRepository.save(componentEntity);
    }

}