class Compiling implements IntentProcessPhase {

    @Override
    public Optional<IntentProcessPhase> execute() {
        try {
            List<Intent> compiled = processor.compile(data.intent(),
                    //TODO consider passing an optional here in the future
                    stored.map(IntentData::installables).orElse(null));
            return Optional.of(new Installing(processor, new IntentData(data, compiled), stored));
        } catch (IntentException e) {
            log.debug("Unable to compile intent {} due to: {}", data.intent(), e);
            if (stored.filter(x -> !x.installables().isEmpty()).isPresent()) {
                // removing orphaned flows and deallocating resources
                return Optional.of(new Withdrawing(processor, new IntentData(data, stored.get().installables())));
            } else {
                return Optional.of(new Failed(data));
            }
        }
    }

      Compiling(IntentProcessor processor, IntentData data, Optional<IntentData> stored);

}