public ActionResult GoalsList(int id)
 {
     if (ibo != null)
     {
         List <Goal> goals = IBOVirtualAPI.GetIBOLevelGoals(ibo.IBONum, id.ToString());
         if ((goals.Count > 0) || (id == 0))
         {
             ViewBag.goalLevel = id;
             ViewBag.nextLevel = id + 1;
             List <Goal> goalsLevel = IBOVirtualAPI.GetIBOLevelGoals(ibo.IBONum, (id + 1).ToString());
             Dictionary <Timeframe, Goal> timeframeGoals = new Dictionary <Timeframe, Goal>();
             List <Timeframe>             timeframes     = IBOVirtualAPI.GetTimeFrames(id, ibo.languageId);
             Timeframe last = timeframes.Last();
             if (goalsLevel.Count < 1)
             {
                 ViewBag.lastItem = last;
             }
             foreach (Timeframe time in timeframes)
             {
                 Goal dream = (from d in goals
                               where d.timeframeId == time.timeframeId
                               select d).FirstOrDefault();
                 timeframeGoals.Add(time, dream);
             }
             return(PartialView(timeframeGoals));
         }
     }
     return(null);
 }