public void savePatientDocument(
      PatientDocumentVo document,
      CatsReferralReportsVo catReferral,
      ReferralOutcomeVo voOutcome,
      PrescriptionsVo selectedPrescription)
      throws StaleObjectException {
    if (document != null) {
      if (!document.isValidated())
        throw new DomainRuntimeException("PatientDocumentVo not validated");
    }

    DomainFactory factory = getDomainFactory();

    // WDEV-13956
    Prescription prescription =
        PrescriptionsVoAssembler.extractPrescription(factory, selectedPrescription);
    factory.save(prescription);
    // end

    PatientDocument doc = PatientDocumentVoAssembler.extractPatientDocument(factory, document);
    factory.save(doc);

    CatsReferral doCatsReferral =
        CatsReferralReportsVoAssembler.extractCatsReferral(factory, catReferral);
    if (catReferral != null) doCatsReferral.getReferralDocuments().add(doc);

    factory.save(doCatsReferral);

    // --------------wdev-14193
    prescription =
        (Prescription)
            factory.getDomainObject(Prescription.class, selectedPrescription.getID_Prescription());
    PrescriptionsVo temppre = PrescriptionsVoAssembler.create(prescription);
    if (voOutcome != null) {
      if (voOutcome.getPrescriptions().contains(temppre)) {
        voOutcome.getPrescriptions().remove(temppre);
        voOutcome.getPrescriptions().add(temppre);
      }
    }
    // -----------

    ReferralOutcome doRef = ReferralOutcomeVoAssembler.extractReferralOutcome(factory, voOutcome);
    factory.save(doRef);
  }
  public Boolean savePatientDocument(
      PatientDocumentVo patientDocument, PatientAssessmentVo patientAssessment)
      throws StaleObjectException {
    if (patientDocument == null) throw new DomainRuntimeException("Invalid PatientDocument record");
    if (!patientDocument.isValidated())
      throw new DomainRuntimeException("PatientDocument record not validated");
    if (patientAssessment == null) throw new DomainRuntimeException("Invalid patient assessment");
    if (!patientAssessment.isValidated())
      throw new DomainRuntimeException("User assessment not validated");

    DomainFactory factory = getDomainFactory();

    // Save PatientDocumet record
    PatientDocument domainPatientDocument =
        PatientDocumentVoAssembler.extractPatientDocument(factory, patientDocument);
    factory.save(domainPatientDocument);

    // Save PatientAssessment record
    PatientAssessment domainObject =
        PatientAssessmentVoAssembler.extractPatientAssessment(factory, patientAssessment);
    factory.save(domainObject);

    return true;
  }