class EventGenerationIdsChecker {

    public boolean isInSync(UserSyncStatus userSyncStatus, UmsEventGenerationIds currentGeneration) {
        Stack stack = userSyncStatus.getStack();
        boolean inSync = userSyncStatus != null &&
                userSyncStatus.getUmsEventGenerationIds() != null;
        if (inSync) {
            try {
                UmsEventGenerationIds lastUmsEventGenerationIds = userSyncStatus.getUmsEventGenerationIds().get(UmsEventGenerationIds.class);
                inSync = currentGeneration.equals(lastUmsEventGenerationIds);
            } catch (IOException e) {
                LOGGER.warn("Failed to retrieve UmsEventGenerationIds for Environment {} in Account {}. Assuming not in sync",
                        stack.getEnvironmentCrn(), stack.getAccountId());
                inSync = false;
            }
        }
        LOGGER.debug("Environment {} in Account {} {} in sync", stack.getEnvironmentCrn(), stack.getAccountId(), inSync ? "is" : "is not");
        return inSync;
    }

}