public AppResult Get(string _synappsDeviceId, string _deviceId, string _personId, string _personReply, string _personTalk, string _personTalkKeyphrase, string _weather, bool _isFreeTalk = false)
        {
            var appResult = new AppResult();
            var apiResult = new ApiResult();

            apiResult.IsSuccessStatusCode = true;

            RobotBehaviorModel behavior = null;
            var model             = RobotBehaviorToPersonModel.FindLatestOne(_deviceId, _personId);
            var numberOfMeetToday = RobotBehaviorToPersonModel.NumberOfMeetToday(_deviceId, _personId) + 1;

            if (model != null)
            {
                TimeSpan ts = DateTime.Today - model.CreatedAt.Date;
                int      differenceInDays = ts.Days;

                var talklogModel = RobotBehaviorTalkLogModel.FindAllActiveKeyphrase(_deviceId, _personId);
                var talklogs     = new List <string>();
                foreach (var talklog in talklogModel)
                {
                    talklogs.Add(talklog.PersonTalkKeyphrase);
                }

                var keyphraseModel = RobotBehaviorKeyphraseModel.Find(_synappsDeviceId, talklogs);
                var keyphraseText  = keyphraseModel != null ? keyphraseModel.Keyphrase : "";
                var keyphraseReply = keyphraseModel != null ? keyphraseModel.KeyphraseReply : "";

                if (model.Status == RobotBehaviorToPersonModel.Active && keyphraseText != "")
                {
                    behavior = RobotBehaviorModel.Find(_synappsDeviceId, HasKeyphrase);
                    var actionBody = new ActionBody(behavior.ActionBody);
                    appResult.appBody = getAppBody(actionBody, _personReply, keyphraseText, keyphraseReply, differenceInDays.ToString(), numberOfMeetToday, model.Weather, _personId);

                    foreach (var talklog in talklogModel)
                    {
                        if (keyphraseText == talklog.PersonTalkKeyphrase && _personReply != "")
                        {
                            talklog.Status = RobotBehaviorTalkLogModel.InActive;
                            talklog.Save();
                        }
                    }
                }
                else
                {
                    if (differenceInDays == 0)
                    {
                        behavior = RobotBehaviorModel.Find(_synappsDeviceId, Today);
                        var actionBody = new ActionBody(behavior.ActionBody);
                        appResult.appBody = getAppBody(actionBody, _personReply, keyphraseText, keyphraseReply, differenceInDays.ToString(), numberOfMeetToday, model.Weather, _personId);
                    }
                    else
                    {
                        if (_isFreeTalk)
                        {
                            behavior = RobotBehaviorModel.Find(_synappsDeviceId, FreeTalk);
                            var actionBody = new ActionBody(behavior.ActionBody);
                            appResult.appBody = getAppBody(actionBody, _personTalkKeyphrase, keyphraseText, keyphraseReply, differenceInDays.ToString(), numberOfMeetToday, model.Weather, _personId);
                        }
                        else
                        {
                            if (_weather == WeatherClear)
                            {
                                behavior = RobotBehaviorModel.Find(_synappsDeviceId, PastDaysClear);
                                var actionBody = new ActionBody(behavior.ActionBody);
                                appResult.appBody = getAppBody(actionBody, _personReply, keyphraseText, keyphraseReply, differenceInDays.ToString(), numberOfMeetToday, model.Weather, _personId);
                            }
                            else
                            {
                                behavior = RobotBehaviorModel.Find(_synappsDeviceId, PastDaysNoneClear);
                                var actionBody = new ActionBody(behavior.ActionBody);
                                appResult.appBody = getAppBody(actionBody, _personReply, keyphraseText, keyphraseReply, differenceInDays.ToString(), numberOfMeetToday, model.Weather, _personId);
                            }
                        }
                    }
                }
            }
            else
            {
                behavior = RobotBehaviorModel.Find(_synappsDeviceId, FirstContact);
                var actionBody = new ActionBody(behavior.ActionBody);
                appResult.appBody = getAppBody(actionBody, _personReply, "", "", "", numberOfMeetToday, "", _personId);
            }

            if (appResult.appBody.IsNoReaction == true || _personReply != "")
            {
                SaveHistory(_deviceId, _personId, behavior.SynAppsId, _weather);
            }
            appResult.apiResult = apiResult;

            return(appResult);
        }