class StackImageUpdateService {

    public void storeNewImageComponent(Stack stack, StatedImage image) {
        Component imageComponent;
        try {
            Image newImage = getImageModelFromStatedImage(stack, image);
            imageComponent = new Component(ComponentType.IMAGE, ComponentType.IMAGE.name(), new Json(newImage), stack);
        } catch (IllegalArgumentException e) {
            LOGGER.info("Failed to create json", e);
            throw new CloudbreakServiceException("Failed to create json", e);
        }

        componentConfigProviderService.replaceImageComponentWithNew(imageComponent);
    }

}