public void ProcessPostJobConversation(TxtMsgInbound msgInbound, TxtMsgAwaitingResponse awaiting, AppUser parentUser)
        {
            string conversationContext;
            string msg;

            if (MessageUtility.IsCancelRequested(msgInbound))
            {
                msg = "Ok, job posting cancelled";
                _omm.SendFeedbackToInboundMessageAndDeleteAwaiting(msgInbound, msg, parentUser.Id, awaiting);
            }

            switch (msgInbound.InboundMessageType)
            {
                case InboundMessageType.PostJob_Step2_DayOfWeek:
                    DayOfWeekMessage? dayOfWeek = MessageUtility.ParseDayOfWeek(msgInbound.Message);
                    if (dayOfWeek == null)
                    {
                        msg = string.Format("Invalid day of week, post a job for which day: {0}? Or say 'cancel'", new NewCommandManager().DaysOfWeekStartingToday(parentUser));
                        _omm.SendFeedbackToInboundMessage(msgInbound, msg, parentUser.Id);
                    }
                    else
                    {
                        conversationContext = JsonSerializerHelper.Serialize(new PostJobViaTxtAnswers {DayOfWeek = dayOfWeek.Value});
                        msg = "What time?";
                        _omm.SendFeedbackToInboundMessageAndAwait(msgInbound, msg, parentUser.Id, InboundMessageType.PostJob_Step3_StartTime, awaiting, conversationContext);
                    }
                    break;
                case InboundMessageType.PostJob_Step3_StartTime:
                    JobTimeSmall startHour = MessageUtility.ParseStartTime(msgInbound.Message, _log);
                    if (startHour == null)
                    {
                        msg = string.Format("Please enter a valid job start time. Valid examples: 9am, 9pm, 12:30am, 10:00pm. What time?");
                        _omm.SendFeedbackToInboundMessage(msgInbound, msg, parentUser.Id);
                    }
                    else
                    {
                        var postJobAnswers = JsonSerializerHelper.DeSerialize<PostJobViaTxtAnswers>(awaiting.ConversationMemory);
                        postJobAnswers.StartHour = startHour;
                        conversationContext = JsonSerializerHelper.Serialize(postJobAnswers);
#if OFF
                        var sits = ListSittersForParent(msgInbound.UserId);
                        if (sits == null)
                        {
                            msg = "Unable to post job because you do not have any sitters. Please invite babysitters to your MySitters."; //FutureDev: do this earlier
                            _omm.SendFeedbackToInboundMessage(msgInbound, msg);
                            _txtMsgAwaitingResponseDal.DeleteAwaiting(awaiting.Id);
                        }
                        else
                        {
                            newAwaitingType = InboundMessageType.PostJob_Step5_Confirm;
                            msg = string.Format("Which sitters? {0}", sits);
                        }
#endif
                        msg = MessageUtility.FormatJobConfirm(postJobAnswers, parentUser, _parentRepository);
                        _omm.SendFeedbackToInboundMessageAndAwait(msgInbound, msg, parentUser.Id, InboundMessageType.PostJob_Step5_Confirm, awaiting, conversationContext);
                    }
                    break;
#if OFF
                case InboundMessageType.PostJob_Step4_SelectSitters:
                    int? sitterId = ParseSitterNum(msgInbound.Message, msgInbound.UserId);

#endif

                case InboundMessageType.PostJob_Step5_Confirm:
                    MessageAffirmativeType affirmative = MessageUtility.ParseAffirmativeType(msgInbound, true);

                    if (affirmative == MessageAffirmativeType.yes)
                    {
                        var pa = JsonSerializerHelper.DeSerialize<PostJobViaTxtAnswers>(awaiting.ConversationMemory);

                        var jobSM = new PostJobSM();


                        jobSM.DateTimeStartDte = MessageUtility.CalcJobStartTime(pa).AddHours(- parentUser.TimezoneOffset); // Convert to UTC
                        jobSM.Duration = 3; // note, default to 3
                        jobSM.JobInvites = new List<JobInvite>();
                        List<ParentMySitterSM> psitters = _parentRepository.GetSittersForParent(parentUser.Id).Sitters;
                        foreach (ParentMySitterSM s in psitters)
                        {
                            jobSM.JobInvites.Add(new JobInvite { SitterId = s.Id, InvitedDate = TimeUtil.GetCurrentUtcTime(), RatePerHour = s.Rate, State = InvitationState.InvitePending });
                        }

                        jobSM.ParentId = parentUser.Id;
                        _jobRepo.PostJob(jobSM);

                        _omm.SendFeedbackToInboundMessageAndDeleteAwaiting(msgInbound, "Congrats! Job posted. You can view details at mysitterhub.com", parentUser.Id, awaiting);
                    }
                    else if (affirmative == MessageAffirmativeType.no)
                    {
                        _omm.SendFeedbackToInboundMessageAndDeleteAwaiting(msgInbound, "Ok, Job posting cancelled", parentUser.Id, awaiting); //note, this will only get hit when the user says "no".
                    }
                    else
                    {
                        _omm.SendFeedbackToInboundMessage(msgInbound, "Please say 'yes' to post job or 'cancel'", parentUser.Id);
                    }

                    break;
                default:
                    throw new Exception("InboundMessageType not recognized in ProcessPostJobConversation. " + msgInbound.InboundMessageType);
            }
        }
        public PostJobResultSM PostJob(PostJobSM jobSm)
        {
            foreach (var invite in jobSm.JobInvites)
            {
                invite.InvitedDate = TimeUtil.GetCurrentUtcTime();
            }

            var job = new Job();
            job.ParentId = jobSm.ParentId;
            job.Notes = jobSm.Notes;
            job.Start = jobSm.DateTimeStartDte != null ? jobSm.DateTimeStartDte.Value : DateTime.Parse(jobSm.DateTimeStart);
            job.Duration = jobSm.Duration;
            job.JobInvites = jobSm.JobInvites;
            job.State = JobState.Posted;
            
            PostJobResultSM result = ValidateJobForInsert(job);
            if (!result.HasError)
            {
                _jobDal.Insert(job);
            }
            return result;
        }