private void buildRequesters() {
   requesters = sampleRequesterDAO.getRequestersForSampleId(sampleId);
   for (SampleRequester requester : requesters) {
     if (requester.getRequesterTypeId() == Requester.PERSON.getId()) {
       Person person = personDAO.getPersonById(String.valueOf(requester.getRequesterId()));
       personService = new PersonService(person);
     } else if (requester.getRequesterTypeId() == Requester.ORGANIZATION.getId()) {
       organization =
           organizationDAO.getOrganizationById(String.valueOf(requester.getRequesterId()));
     }
   }
 }
  public SampleRequester getSampleRequesterByType(Requester type, boolean createIfNotFound) {
    if (requesters == null) {
      buildRequesters();
    }

    for (SampleRequester requester : requesters) {
      if (requester.getRequesterTypeId() == type.getId()) {
        return requester;
      }
    }

    // reachable only if existing requester not found
    if (createIfNotFound) {
      SampleRequester newRequester = new SampleRequester();
      newRequester.setRequesterTypeId(type.getId());
      newRequester.setSampleId(Long.parseLong(sampleId));

      return newRequester;
    }

    return null;
  }