public ActionResult <ExperimentForCreateDto> Create( Guid plantId, [FromBody] ExperimentForCreateDto experiment) { if (!_experimentRepository.PlantExists(plantId)) { return(NotFound()); } var experimentEntity = _mapper.Map <Entities.Experiment>(experiment); _experimentRepository.AddExperiment(plantId, experimentEntity); _experimentRepository.Save(); var experimentDto = _mapper.Map <ExperimentDto>(experimentEntity); return(CreatedAtRoute( "GetExperiment", new { plantId = plantId, experimentId = experimentDto.Id }, experimentDto)); }