class StackRepairService {

    public void add(Stack stack, Collection<String> unhealthyInstanceIds) {
        if (unhealthyInstanceIds.isEmpty()) {
            LOGGER.debug("No instances are unhealthy, returning...");
            flowMessageService.fireEventAndLog(stack.getId(), Status.AVAILABLE.name(), STACK_REPAIR_COMPLETE_CLEAN);
            return;
        }
        UnhealthyInstances unhealthyInstances = groupInstancesByHostGroups(stack, unhealthyInstanceIds);
        Runnable stackRepairFlowSubmitter = new StackRepairFlowSubmitter(stack.getId(), unhealthyInstances);
        flowMessageService.fireEventAndLog(stack.getId(), Status.UPDATE_IN_PROGRESS.name(), STACK_REPAIR_ATTEMPTING);
        executorService.submit(stackRepairFlowSubmitter);
    }

}