class ApplicationFinanceServiceImpl extends AbstractFinanceService<ApplicationFinance, ApplicationFinanceResource> implements ApplicationFinanceService {

    @Override
    @Transactional
    public ServiceResult<ApplicationFinanceResource> findApplicationFinanceByApplicationIdAndOrganisation(long applicationId, long organisationId) {
        Optional<ApplicationFinance> finance = applicationFinanceRepository.findByApplicationIdAndOrganisationId(applicationId, organisationId);
        if (!finance.isPresent()) {
            return createApplicationFinance(applicationId, organisationId);
        }
        return serviceSuccess(applicationFinanceMapper.mapToResource(finance.get()));
    }

}