public ActionResult AddHomeAffairsOfficer(List <KeyValue> homeAffairsOfficer)
 {
     try
     {
         var homeAffairsOfficerPersonId = Guid.NewGuid().ToString();
         KeyValueService.AddAttribute(homeAffairsOfficer, "Id", homeAffairsOfficerPersonId);
         GenericModelService.AddAuditAttributeForCreateEvent(homeAffairsOfficer, GetCurrentUserId());
         var homeAffairsOfficerPersonReturnObject = PersonService.InsertPerson(homeAffairsOfficer);
         if (homeAffairsOfficerPersonReturnObject.State != "success")
         {
             return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet));
         }
         KeyValueService.AddAttribute(homeAffairsOfficer, "PersonId",
                                      homeAffairsOfficerPersonReturnObject.Id);
         var homeAffairsOfficerReturnObject =
             HomeAffairsOfficerService.InsertHomeAffairesOfficer(homeAffairsOfficer);
         if (homeAffairsOfficerReturnObject.State != "success")
         {
             return(Json(new { state = "error", message = "" }, JsonRequestBehavior.AllowGet));
         }
         var newHomeAffairsOfficer =
             HomeAffairsOfficerService.QueryHomeAffairsOfficerById(
                 Guid.Parse(homeAffairsOfficerReturnObject.Id));
         return(Json(new { state = "success", homeAffairsOfficer = newHomeAffairsOfficer },
                     JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { state = "error", message = ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
        public ActionResult GetHomeAffairsOfficerById(Guid homeAffairsOfficerId)
        {
            var record = HomeAffairsOfficerService.QueryHomeAffairsOfficerById(homeAffairsOfficerId);

            return(Json(record, JsonRequestBehavior.AllowGet));
        }