public TrackingStatusDTO mapFrom(Tracker tracker) {
      TrackingStatusDTO trackingStatus = new TrackingStatusDTO();
      trackingStatus.setTrackingNumber(tracker.getTrackingCode());
      trackingStatus.setTrackerId(tracker.getId());
      trackingStatus.setWeight(BigDecimal.valueOf(tracker.getWeight()));
      trackingStatus.setEstimatedDeliveryDate(tracker.getEstDeliveryDate());
      trackingStatus.setCarrier(tracker.getCarrier());
      trackingStatus.setStatus(TrackingStatus.Status.valueOf((tracker.getStatus().toUpperCase())));

      if (tracker.getCarrierDetail() != null) {
        trackingStatus.setShippingMethod(tracker.getCarrierDetail().getService());
      }

      if (tracker.getTrackingDetails() != null && !tracker.getTrackingDetails().isEmpty()) {
        trackingStatus.setUpdated(
            tracker
                .getTrackingDetails()
                .get(tracker.getTrackingDetails().size() - 1)
                .getDatetime());
      }

      if (hasHistory) {
        trackingStatus.setTrackingHistories(
            tracker.getTrackingDetails().stream().map(TrackingHistoryDTO::new).collect(toList()));
      }
      return trackingStatus;
    }
    public TrackingStatusDTO mapFrom(TrackingStatus trackingStatus) {
      TrackingStatusDTO dto = new TrackingStatusDTO();
      dto.setTrackerId(trackingStatus.getTrackerId());
      dto.setPackageId(trackingStatus.getPackageId());
      dto.setTrackingNumber(trackingStatus.getTrackingNumber());
      dto.setWeight(trackingStatus.getWeight());
      dto.setEstimatedDeliveryDate(trackingStatus.getEstimatedDeliveryDate());
      dto.setCarrier(trackingStatus.getCarrier());
      dto.setUpdated(trackingStatus.getUpdated());
      dto.setStatus(trackingStatus.getStatus());
      dto.setCreated(trackingStatus.getCreated());
      dto.setShippingMethod(trackingStatus.getShippingMethod());

      if (hasHistory) {
        dto.setTrackingHistories(
            trackingStatus
                .getTrackingHistories()
                .stream()
                .map(TrackingHistoryDTO::new)
                .collect(toList()));
      }
      return dto;
    }