public JobResult SendJob(JobModel model)
        {
            try
            {
                if (model == null || model.Data == null)
                {
                    return(new JobResult {
                        Error = "Invalid payload.", Status = Core.Database.Entities.ProcessStatus.InvalidData
                    });
                }

                return(_service.CreateJob(model));
            }
            catch (Exception ex)
            {
                return(new JobResult {
                    Error = "Unhandled error while sending job.", Status = Core.Database.Entities.ProcessStatus.Failed
                });
                //log error
            }
        }
        public JobResult CreateJob(JobModel incomingJob)
        {
            // This is just to test error condition

            if (incomingJob.Data is string && ((string)incomingJob.Data == "abc"))
            {
                throw new Exception("Testing unhandled errors");
            }

            var job = new Job
            {
                Id        = Guid.NewGuid(),
                Status    = ProcessStatus.Created,
                CreatedOn = DateTime.Now,
                Data      = incomingJob.Data
            };

            _dbContext.Jobs.Add(job);
            return(new JobResult {
                Id = job.Id, Status = job.Status
            });
        }