public async Task <CreateBatchArtifactOptionResponse> Post(CreateBatchArtifactOptionRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var batchArtifact = await batchRepository.GetBatchArtifact(request.BatchId, request.ArtifactName); if (batchArtifact == null) { throw Err.BatchArtifactNotFound(request.ArtifactName); } if (await batchRepository.DoesBatchArtifactOptionExist(request.BatchId, request.ArtifactName, request.OptionName)) { throw Err.BatchArtifactOptionAlreadyExists(request.OptionName); } var batchArtifactOption = request.ConvertTo <BatchArtifactOption>(); batchArtifactOption.BatchArtifactId = batchArtifact.Id; await batchRepository.CreateOrUpdateBatchArtifactOption(batchArtifactOption); return(new CreateBatchArtifactOptionResponse()); }