class ApplicationFinanceSummaryViewModelPopulator {

    public ApplicationFinanceSummaryViewModel populate(long applicationId, UserResource user) {
        ApplicationResource application = applicationRestService.getApplicationById(applicationId).getSuccess();
        CompetitionResource competition = competitionRestService.getCompetitionById(application.getCompetition()).getSuccess();
        List<ProcessRoleResource> processRoles = userRestService.findProcessRole(applicationId).getSuccess();
        Optional<ProcessRoleResource> currentApplicantRole = getCurrentUsersRole(processRoles, user);

        return new ApplicationFinanceSummaryViewModel(competition, financeSummaryTableViewModelPopulator.populateAllOrganisations(application, competition, processRoles, user),
                currentApplicantRole.map(ProcessRoleResource::getOrganisationId).orElse(null));
    }

}