public PatientResponse GetPatients(PatientRequest request) { PatientResponse response = new PatientResponse(); // Set correlation Id response.CorrelationId = request.RequestId; try { // Get customer list via Customer Facade. PatientFacade facade = new PatientFacade(); IList<Patient> list = facade.GetPatients(request.SortExpression); response.Patients = new PatientTransferObject[list.Count]; Console.WriteLine(list.Count.ToString()); // Package customer data in Customer Transfer Object int index = 0; foreach (Patient patient in list) { PatientTransferObject transfer = new PatientTransferObject(); transfer.PatientID = patient.PatientID; transfer.FName = patient.fName; transfer.LName = patient.LName; transfer.Phone = patient.Phone; response.Patients[index++] = transfer; } } catch // (Exception ex) { response.Acknowledge = AcknowledgeType.Failure; response.Message = "Request cannot be handled at this time."; } return response; }