public ActionResult Create_(Goal goal)
        {
            // This method is casting the values from the form and validating the state.
            // However, since there are some fiels as of now that we are still not adding, 
            // the validate state is failing. We have workarounds to add the missing values 
            // and validate the state. The issue is that we wont know anymore if 
            // there was some legit error coming from the site.

            var goals = new Goals(SessionProvider.CurrentSession);
            var anyGoal = goals.GetAll().First();
            goal.CreatedOn = DateTime.Now;
            goal.Venue = anyGoal.Venue;
            goal.Sport = anyGoal.Sport;
            goal.UserCreator = anyGoal.UserCreator;


            ModelState.Where(m => m.Value.Errors != null).ToList().ForEach(e =>
                                                                               {
                                                                                   var error = e.Value.Errors;
                                                                                   error.Clear();
                                                                               });

            UpdateModel(goal);
            if (ModelState.IsValid)
            {
                goals.Add(goal);
                return RedirectToAction("Details", new { Id = goal.Id });
            }

            GoalViewModel goalViewModel = AutoMapper.Mapper.Map<Goal, GoalViewModel>(goal);

            return View(goalViewModel);
        }
        public ActionResult index_json()
        {
            // http://localhost/endurancegoals/goals
            Goals goals = new Goals(SessionProvider.OpenSession());
            var goalList = goals.GetAll();

            var jsonGoals = JsonBuilder.BuildJsonGoal(goalList);

            return Json(new { success = jsonGoals }, JsonRequestBehavior.AllowGet);
        }
        public ActionResult JsonList()
        {
            Goals goals = new Goals(SessionProvider.OpenSession());
            var goalList = goals.GetAll();

            var jsonGoals = JsonBuilder.BuildJsonGoal(goalList);

            return Json(new { success = jsonGoals }, JsonRequestBehavior.AllowGet);
        }