class MatchingServiceResponseService {

    public void handleSuccessResponse(SessionId sessionId, SamlResponseDto samlResponse) {
        getSessionIfItExists(sessionId);

        SamlResponseContainerDto samlResponseContainer = new SamlResponseContainerDto(
            samlResponse.getSamlResponse(),
            sessionRepository.getRequestIssuerEntityId(sessionId)
        );

        try {
            InboundResponseFromMatchingServiceDto inboundResponseFromMatchingServiceDto = samlEngineProxy.translateMatchingServiceResponse(samlResponseContainer);
            updateSessionState(sessionId, inboundResponseFromMatchingServiceDto);
        } catch(ApplicationException e) {
            // this is not ideal but if the call to saml-proxy fails we want to log the failure
            // in the state and then process the exception
            logExceptionAndUpdateState("Error translating matching service response", sessionId, e);
        }
    }

    @Inject public  MatchingServiceResponseService(SamlEngineProxy samlEngineProxy,
                                          SessionRepository sessionRepository,
                                          HubEventLogger eventLogger);

}