class DatabaseFDFlowManager extends BaseService implements FDFlowManager {

    @Override
    public FDFlowMetadata deleteFlow(final String flowId) {
        if (StringUtils.isBlank(flowId)) {
            throw new IllegalArgumentException("Flow id cannot be null or blank");
        }

        final Optional<FDFlowEntity> flowEntity = flowRepository.findById(flowId);
        if (!flowEntity.isPresent()) {
            throw new ResourceNotFoundException("No flow exists with the provided flow id");
        }

        // delete from DB
        flowRepository.delete(flowEntity.get());

        // delete from cache
        if (flowsById.containsKey(flowId)) {
            flowsById.remove(flowId);
        }

        return modelMapper.map(flowEntity.get(), FDFlowMetadata.class);
    }

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

}