class E2EServiceInstances {

    private Response getE2EServiceInstance(String serviceId, String operationId, String version) {

        GetE2EServiceInstanceResponse e2eServiceResponse = new GetE2EServiceInstanceResponse();

        String apiVersion = version.substring(1);

        OperationStatus operationStatus;

        try {
            operationStatus = requestsDbClient.getOneByServiceIdAndOperationId(serviceId, operationId);
        } catch (Exception e) {
            logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA,
                    ErrorCode.AvailabilityError.getValue(),
                    "Exception while communciate with Request DB - Infra Request Lookup", e);
            Response response =
                    msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException,
                            e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version);
            logger.debug(END_OF_THE_TRANSACTION + response.getEntity());
            return response;

        }

        if (operationStatus == null) {
            Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NO_CONTENT,
                    MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB",
                    ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version);
            logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(),
                    MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(),
                    "Null response from RequestDB when searching by serviceId");
            logger.debug(END_OF_THE_TRANSACTION + resp.getEntity());
            return resp;

        }

        e2eServiceResponse.setOperation(operationStatus);

        return builder.buildResponse(HttpStatus.SC_OK, null, e2eServiceResponse, apiVersion);
    }

}