private JobInfo UpdateResultUrl(JobInfo jobInfo, bool includeDetails)
        {
            jobInfo.Url = ProtocolHelper.EnforceProtocol(Url.Route(ExperienceExtractorWebApiConfig.JobRouteName, new { id = jobInfo.Id }));

            if (jobInfo.HasResult)
            {
                jobInfo.ResultUrl = ProtocolHelper.EnforceProtocol(Url.Route(ExperienceExtractorWebApiConfig.JobResultRouteName, new { id = jobInfo.Id }));
            }

            if (!includeDetails)
            {
                jobInfo.Specification = null;
                jobInfo.LastException = null;
            }

            return(jobInfo);
        }
        // POST api/jobs
        public async Task <IHttpActionResult> Post(HttpRequestMessage request)
        {
            var content = await request.Content.ReadAsStringAsync();

            try
            {
                var specification = new JsonJobParser(JObject.Parse(content));
                var jobInfo       = _repository.CreateJob(specification);

                var    urlHelper = new UrlHelper(request);
                string url       = urlHelper.Link(ExperienceExtractorWebApiConfig.JobRouteName, new { id = jobInfo.Id });
                return(Redirect(ProtocolHelper.EnforceProtocol(url)));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }