private ReviewRecordPair buildReviewRecordPairFromLoggedLink(LoggedLink link) {
   ReviewRecordPair pair = new ReviewRecordPair();
   pair.setReviewRecordPairId(link.getLinkId());
   pair.setDateCreated(link.getDateCreated());
   pair.setUserCreatedBy(link.getUserCreatedBy());
   pair.setWeight(link.getWeight());
   return pair;
 }
  @Override
  public LoggedLinkListWeb getLoggedLinks(LoggedLinkSearchCriteriaWeb search) throws Exception {
    authenticateCaller();
    try {
      AuditEventService auditEventService = Context.getAuditEventService();
      EntityDefinitionManagerService entityDefService = Context.getEntityDefinitionManagerService();
      RecordQueryService entityInstanceService = Context.getRecordQueryService();

      LoggedLinkListWeb loggedLinkList = new LoggedLinkListWeb();

      // entity model
      EntityWeb entityModel = search.getEntityModel();
      Entity entityDef = entityDefService.loadEntity(entityModel.getEntityVersionId());
      if (entityDef == null) {
        loggedLinkList.setTotalCount(0);
        loggedLinkList.setRecordPairs(new java.util.ArrayList<RecordLinkWeb>());
        return loggedLinkList;
      }

      //  total count
      int totalCount =
          auditEventService.getLoggedLinksCount(entityDef.getEntityVersionId(), search.getVector());
      if (totalCount == 0) {
        loggedLinkList.setTotalCount(0);
        loggedLinkList.setRecordPairs(new java.util.ArrayList<RecordLinkWeb>());
        return loggedLinkList;
      }

      // link logs
      List<LoggedLink> links =
          auditEventService.getLoggedLinks(
              entityDef.getEntityVersionId(),
              search.getVector(),
              search.getFirstResult(),
              search.getMaxResults());

      List<RecordLinkWeb> recordLinks = new java.util.ArrayList<RecordLinkWeb>();
      for (LoggedLink link : links) {

        Record leftRecord = entityInstanceService.loadRecordById(entityDef, link.getLeftRecordId());
        Record rightRecord =
            entityInstanceService.loadRecordById(entityDef, link.getRightRecordId());

        if (leftRecord != null && rightRecord != null) {
          RecordLinkWeb recordLinkWeb = new RecordLinkWeb();
          recordLinkWeb.setWeight(link.getWeight());
          recordLinkWeb.setVector(link.getVectorValue());
          recordLinkWeb.setDateCreated(link.getDateCreated());
          recordLinkWeb.setLeftRecord(ModelTransformer.mapToRecord(leftRecord, RecordWeb.class));
          recordLinkWeb.setRightRecord(ModelTransformer.mapToRecord(rightRecord, RecordWeb.class));

          if (link.getUserCreatedBy() != null) {
            UserWeb user =
                ModelTransformer.mapToUser(link.getUserCreatedBy(), UserWeb.class, false);
            recordLinkWeb.setUserCreatedBy(user);
          }

          recordLinks.add(recordLinkWeb);
        }
      }

      loggedLinkList.setTotalCount(totalCount);
      loggedLinkList.setRecordPairs(recordLinks);

      return loggedLinkList;
    } catch (Throwable t) {
      log.error("Failed to execute: " + t.getMessage(), t);
      throw new RuntimeException(t);
    }
  }