public IActionResult Post([FromBody] CreateJobModel jobModel)
        {
            if (!_deploymentSettings.TryGetDeployScripts(
                    jobModel.Project,
                    jobModel.Service,
                    out List <DeploymentScript> scripts))
            {
                // error object corresponding to missing project/service.
                var error = new ErrorModel(
                    "ProjectOrServiceNotFound",
                    $"Project {jobModel.Project} or service {jobModel.Service} was not found.",
                    HttpStatusCode.NotFound);

                return(NotFound(error));
            }

            if (!_deploymentService.TryRunJobIfNotInProgress(
                    jobModel.Project,
                    jobModel.Service,
                    scripts,
                    out DeploymentJob job))
            {
                // error object corresponding to job already running.
                // TODO: probably return currently running job?
                var error = new ErrorModel(
                    "JobAlreadyInProgress",
                    $"Job for the project {jobModel.Project} and service {jobModel.Service} is already running",
                    HttpStatusCode.BadRequest);

                return(BadRequest(error));
            }

            return(Accepted(new DeploymentJobModel(job)));
        }