public async Task <CreateBatchVariableResponse> Post(CreateBatchVariableRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } if (await batchRepository.DoesBatchVariableExist(request.BatchId, request.VariableName)) { throw Err.BatchVariableAlreadyExists(request.VariableName); } var batchVariable = request.ConvertTo <BatchVariable>(); await batchRepository.CreateOrUpdateBatchVariable(batchVariable); return(new CreateBatchVariableResponse()); }