public async Task <CreateStepArtifactResponse> Post(CreateStepArtifactRequest request) { if (!await batchRepository.DoesBatchExist(request.BatchId)) { throw Err.BatchNotFound(request.BatchId); } var step = await stepRepository.Get(request.BatchId, request.StepName); if (step == null) { throw Err.StepNotFound(request.StepName); } if (await stepRepository.DoesStepArtifactExist(request.BatchId, request.StepName, request.ArtifactName)) { throw Err.StepArtifactAlreadyExists(request.ArtifactName); } var stepArtifact = request.ConvertTo <StepArtifact>(); stepArtifact.StepId = step.Id; await stepRepository.CreateStepArtifact(stepArtifact); return(new CreateStepArtifactResponse()); }