code: public static List<MetricDto> transformToDto(List<Metric> metrics) {
          if (metrics == null) {
              throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
          }
  
          List<MetricDto> result = new ArrayList<>();
  
          for (Metric metric : metrics) {
              result.add(transformToDto(metric));
          }
          return result;
      }
docs: Converts list of alert entity objects to list of alertDto objects.
  
  @param   metrics  List of alert entities. Cannot be null.
  
  @return  List of alertDto objects.
  
  @throws  WebApplicationException  If an error occurs.