public async Task<ActionResult> Index(AvailabilityModel model)
 {
     bool saveSuccessful = false;
     if (ModelState.IsValid)
     {
         using (var client = new DataServiceClient())
         {
             client.Open();
             var infoToStore = new Availability();
             infoToStore.applicantId = Convert.ToInt32(this.Session["ApplicantId"]);
             infoToStore.daysYN = model.daysYN;
             infoToStore.eveningsYN = model.eveningsYN;
             infoToStore.weekendsYN = model.weekendsYN;
             infoToStore.fullTimeYN = model.fullTimeYN;
             infoToStore.salaryExpected = model.salaryExpected;
             infoToStore.mondayFrom = model.mondayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.mondayFrom - 1, 0, 0)) : null;
             infoToStore.mondayTo = model.mondayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.mondayTo - 1, 0, 0)) : null;
             infoToStore.tuesdayFrom = model.tuesdayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.tuesdayFrom - 1, 0, 0)) : null;
             infoToStore.tuesdayTo = model.tuesdayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.tuesdayTo - 1, 0, 0)) : null;
             infoToStore.wednesdayFrom = model.wednesdayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.wednesdayFrom - 1, 0, 0)) : null;
             infoToStore.wednesdayTo = model.wednesdayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.wednesdayTo - 1, 0, 0)) : null;
             infoToStore.thursdayFrom = model.thursdayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.thursdayFrom - 1, 0, 0)) : null;
             infoToStore.thursdayTo = model.thursdayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.thursdayTo - 1, 0, 0)) : null;
             infoToStore.fridayFrom = model.fridayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.fridayFrom - 1, 0, 0)) : null;
             infoToStore.fridayTo = model.fridayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.fridayTo - 1, 0, 0)) : null;
             infoToStore.saturdayFrom = model.saturdayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.saturdayFrom - 1, 0, 0)) : null;
             infoToStore.saturdayTo = model.saturdayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.saturdayTo - 1, 0, 0)) : null;
             infoToStore.sundayFrom = model.sundayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.sundayFrom - 1, 0, 0)) : null;
             infoToStore.sundayTo = model.sundayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.sundayTo - 1, 0, 0)) : null;
             infoToStore.applicantId = model.applicantId;
             saveSuccessful = await client.updateAvailabilityAsync(infoToStore);
             client.Close();
         }
         if (saveSuccessful)
         {
             this.Session["Availability"] = "Done";
             return RedirectToAction("Index", "JobHistory");
         }
         else
         {
             //some error has occured saving --currently do nothing
         }
     }
     return View(model);
 }