@Override
 @Secured
 public Value addValue(Value value) throws ServiceException {
   TestExecution exec = testExecutionDAO.get(value.getTestExecution().getId());
   if (exec == null) {
     throw new ServiceException(
         "serviceException.addValue.testExecutionNotFound", value.getTestExecution().getName());
   }
   Metric metric = null;
   if (value.getMetric().getId() != null) {
     metric = metricDAO.get(value.getMetric().getId());
   } else {
     List<Metric> metrics =
         metricDAO.getMetricByNameAndGroup(
             value.getMetric().getName(), exec.getTest().getGroupId());
     if (metrics.size() > 0) {
       metric = metricDAO.get(metrics.get(0).getId());
     }
   }
   if (metric == null) {
     throw new ServiceException("serviceException.metricNotFound", value.getMetric().getName());
   }
   value.setTestExecution(exec);
   value.setMetric(metric);
   // check if other values for given metric exist, if yes, we can only add one if both old and new
   // one have at least one parameter
   List<Value> existingValuesForMetric = valueDAO.find(exec.getId(), metric.getId());
   if (!existingValuesForMetric.isEmpty()) {
     for (Value v : existingValuesForMetric) {
       if (!v.hasParameters()) {
         throw new ServiceException("serviceException.unparametrizedMultiValue");
       }
     }
     if (!value.hasParameters()) {
       throw new ServiceException("serviceException.unparametrizedMultiValue");
     }
   }
   Value freshValue = valueDAO.create(value);
   Value freshValueClone = freshValue.clone();
   List<ValueParameter> newParams = new ArrayList<ValueParameter>();
   if (value.hasParameters()) {
     for (ValueParameter valueParameter : value.getParameters()) {
       valueParameter.setValue(freshValue);
       newParams.add(valueParameterDAO.create(valueParameter).clone());
       newParams.get(newParams.size() - 1).setValue(freshValueClone);
     }
   }
   freshValueClone.setParameters(newParams.isEmpty() ? null : newParams);
   return freshValueClone;
 }