class StackImageUpdateService {

    public boolean isValidImage(Stack stack, String newImageId, String imageCatalogName, String imageCatalogUrl) {
        if (isCbVersionOk(stack)) {
            try {
                Image currentImage = getCurrentImage(stack);
                StatedImage newImage = getNewImage(newImageId, imageCatalogName, imageCatalogUrl, currentImage);

                boolean cloudPlatformMatches = isCloudPlatformMatches(stack, newImage);
                boolean osVersionsMatch = isOsVersionsMatch(currentImage, newImage);
                boolean stackMatchIfPrewarmed = isStackMatchIfPrewarmed(newImage);
                CheckResult status = checkPackageVersions(stack, newImage);
                boolean aggregatedValidationResult = cloudPlatformMatches && osVersionsMatch && stackMatchIfPrewarmed
                        && status.getStatus() == EventStatus.OK;
                if (!aggregatedValidationResult) {
                    LOGGER.info("Image validation for {}:\n "
                                    + "Valid platform? {}\n "
                                    + "Valid os? {}\n "
                                    + "Valid stack (prewarmed only)? {}\n "
                                    + "Valid package versions? {}",
                            newImageId,
                            cloudPlatformMatches,
                            osVersionsMatch,
                            stackMatchIfPrewarmed,
                            status);
                }
                return aggregatedValidationResult;
            } catch (CloudbreakImageNotFoundException e) {
                LOGGER.debug("Cloudbreak Image not found", e);
                return false;
            } catch (CloudbreakImageCatalogException e) {
                LOGGER.debug("Cloudbreak Image catalog error", e);
                return false;
            }
        }
        return false;
    }

}