class DatabaseFDFlowManager extends BaseService implements FDFlowManager {

    @Override
    public Optional<FDFlowEvent> getLatestFlowEvent(final String flowId) {
        final Optional<FDFlowEventEntity> latestFlowEvent = getLatestFlowEventEntity(flowId);
        if (latestFlowEvent.isPresent()) {
            final FDFlowEvent flowEvent = modelMapper.map(latestFlowEvent.get(), FDFlowEvent.class);
            return Optional.of(flowEvent);
        } else {
            // Should always be at least one event per flow, so this really shouldn't happen
            return Optional.empty();
        }
    }

    @Autowired public  DatabaseFDFlowManager(final FDFlowRepository flowRepository,
                                 final FDFlowEventRepository flowEventRepository,
                                 final OptionalModelMapper modelMapper,
                                 final ObjectMapper objectMapper,
                                 final Validator validator);

}