public async Task LinkPatientCareContextFor(LinkPatientRequest request)
        {
            try
            {
                var(patientLinkResponse, cmId, error) = await linkPatient
                                                        .VerifyAndLinkCareContext(new LinkConfirmationRequest(request.Confirmation.Token,
                                                                                                              request.Confirmation.LinkRefNumber));

                var linkedPatientRepresentation = new LinkConfirmationRepresentation();
                if (patientLinkResponse != null || cmId != "")
                {
                    linkedPatientRepresentation = patientLinkResponse.Patient;
                }

                var response = new GatewayLinkConfirmResponse(
                    Guid.NewGuid(),
                    DateTime.Now.ToUniversalTime(),
                    linkedPatientRepresentation,
                    error?.Error,
                    new Resp(request.RequestId)
                    );
                await gatewayClient.SendDataToGateway(PATH_ON_LINK_CONFIRM, response, cmId);
            }
            catch (Exception exception)
            {
                Log.Error(exception, exception.StackTrace);
            }
        }
 public GatewayLinkConfirmResponse(Guid requestId,
                                   DateTime timestamp,
                                   LinkConfirmationRepresentation patient,
                                   Error error,
                                   Resp resp)
 {
     RequestId = requestId;
     Timestamp = timestamp;
     Patient   = patient;
     Error     = error;
     Resp      = resp;
 }
 public PatientLinkConfirmationRepresentation(LinkConfirmationRepresentation patient)
 {
     Patient = patient;
 }