public void SaveContactInformation(ContactViewModel cvm)
        {
            using (SlpContext context = new SlpContext())
            {
                SlpApplication dbApp = context.SlpApplication.Find(cvm.AppId);
                dbApp.StreetAddress = cvm.StreetAddress;
                dbApp.AptNo = cvm.AptNo;
                dbApp.City = cvm.City;
                dbApp.State = cvm.State;
                dbApp.Zip = cvm.Zip;
                dbApp.Email = cvm.Email;
                dbApp.Phone = cvm.Phone;
                dbApp.AdultFilledByName = cvm.AdultFilledByName == null || cvm.AdultFilledByName == "" ? "" : cvm.AdultFilledByName.ToUpper();
                dbApp.EthnicityId = cvm.EthnicityId;
                dbApp.CompletedDate = DateTime.Now;
                dbApp.Steps = string.Join(",", cvm.StepsRequired);

                if (!cvm.StepsRequired.Contains(2))  //if 2 not present, remove data for step 2
                {
                    dbApp.AssistanceProgramId = null;
                    dbApp.AssistanceProgramCaseNumber = "";
                }

                if (!cvm.StepsRequired.Contains(3))  //if 3 not present remove data from step 3, all adults, all income records, total members, ssn field and no ssn field
                {
                    dbApp.TotalMembers = null;
                    dbApp.MemberLastFourSSN = null;
                    dbApp.NoSSN = false;
                    context.Members.RemoveRange(context.Members.Where(a=>a.SlpApplicationId == cvm.AppId && a.IsChild == false)); //remove adults

                    //remove all income responses and income details
                    List<Guid> allmembers = context.Members.Where(a => a.SlpApplicationId == cvm.AppId).Select(a => a.Id).ToList();
                    context.MemberIncomeResponses.RemoveRange(context.MemberIncomeResponses.Where(a=> allmembers.Contains(a.MemberId)));
                }                

                context.SlpApplicationRace.RemoveRange(context.SlpApplicationRace.Where(a => a.SlpApplicationId == cvm.AppId));

                foreach (NameValueViewModel selectedRace in cvm.Races.Where(a=>a.SelectedItem))
                {
                    context.SlpApplicationRace.Add(new SlpApplicationRace { SlpApplicationId = cvm.AppId, RaceId = selectedRace.Value });
                }
                            
                context.SaveChanges();
            }
        }
 public JsonResult SaveContactInformation(ContactViewModel cvm)
 {
     appOrchestrator.SaveContactInformation(cvm);
     return Json(_success, JsonRequestBehavior.AllowGet);
 }