public ActionResult Time(Guid id)
        {
            Common.Models.Matters.Matter matter;
            ViewModels.Matters.MatterTimeViewModel viewModel;
            List<Common.Models.Timing.Time> times;
            ViewModels.Matters.MatterTimeViewModel.Task task;
            ViewModels.Timing.TimeViewModel timeViewModel;
            Common.Models.Contacts.Contact contact;

            viewModel = new ViewModels.Matters.MatterTimeViewModel();
            viewModel.Tasks = new List<ViewModels.Matters.MatterTimeViewModel.Task>();

            using (IDbConnection conn = Data.Database.Instance.GetConnection())
            {
                Data.Tasks.Task.ListForMatter(id, null, conn, false).ForEach(x =>
                {
                    times = Data.Timing.Time.ListForTask(x.Id.Value, conn, false);

                    if (times != null && times.Count > 0)
                    {
                        task = new ViewModels.Matters.MatterTimeViewModel.Task()
                        {
                            Id = x.Id.Value,
                            Title = x.Title
                        };

                        task.Times = new List<ViewModels.Timing.TimeViewModel>();

                        times.ForEach(y =>
                        {
                            timeViewModel = Mapper.Map<ViewModels.Timing.TimeViewModel>(y);

                            contact = Data.Contacts.Contact.Get(timeViewModel.Worker.Id.Value, conn, false);

                            timeViewModel.Worker = Mapper.Map<ViewModels.Contacts.ContactViewModel>(contact);
                            timeViewModel.WorkerDisplayName = timeViewModel.Worker.DisplayName;

                            task.Times.Add(timeViewModel);
                        });

                        viewModel.Tasks.Add(task);
                    }
                });

                matter = Data.Matters.Matter.Get(id, conn, false);
            }

            ViewBag.Matter = matter;

            return View(viewModel);
        }
        public ActionResult Time(Guid id)
        {
            Common.Models.Matters.Matter matter;
            ViewModels.Matters.MatterTimeViewModel viewModel;
            List<Common.Models.Timing.Time> times;
            ViewModels.Matters.MatterTimeViewModel.Task task;
            ViewModels.Timing.TimeViewModel timeViewModel;
            Common.Models.Contacts.Contact contact;

            viewModel = new ViewModels.Matters.MatterTimeViewModel();
            viewModel.Tasks = new List<ViewModels.Matters.MatterTimeViewModel.Task>();

            Data.Tasks.Task.ListForMatter(id, null).ForEach(x =>
            {
                times = Data.Timing.Time.ListForTask(x.Id.Value);

                if (times != null && times.Count > 0)
                {
                    task = new ViewModels.Matters.MatterTimeViewModel.Task()
                    {
                        Id = x.Id.Value,
                        Title = x.Title
                    };

                    task.Times = new List<ViewModels.Timing.TimeViewModel>();

                    times.ForEach(y =>
                    {
                        timeViewModel = Mapper.Map<ViewModels.Timing.TimeViewModel>(y);

                        contact = Data.Contacts.Contact.Get(timeViewModel.Worker.Id.Value);

                        timeViewModel.Worker = Mapper.Map<ViewModels.Contacts.ContactViewModel>(contact);
                        timeViewModel.WorkerDisplayName = timeViewModel.Worker.DisplayName;

                        task.Times.Add(timeViewModel);
                    });

                    viewModel.Tasks.Add(task);
                }
            });

            matter = Data.Matters.Matter.Get(id);
            ViewData["Matter"] = matter.Title;
            ViewData["MatterId"] = matter.Id;

            return View(viewModel);
        }