public ActionResult Create(int projectId, int activityId, TimelogViewModel model)
        {
            var activity = DbSession
                .Include(projectId.ToId("project"))
                .Load<Activity>(activityId);

            var project = DbSession
                .Load<Project>(projectId);

            if (activity == null || activity.Project.ToIdentifier() != projectId)
                return new HttpNotFoundResult();

            var timelog = Timelog.Forge(model.Description, model.Duration, model.Date, DbSession.GetCurrentPerson().Id);
            timelog.Id = activity.GenerateNewTimeEntryId();
            activity.Timelogs.Add(timelog);

            var result = timelog.MapTo<RegisterTimelogsViewModel.Timelog>();
            result.Activity = activity.MapTo<EntityViewModel>();
            result.Project = project.MapTo<EntityViewModel>();

            return new JsonNetResult {Data = result};
        }
        public ActionResult Edit(int projectId, int activityId, TimelogViewModel model)
        {
            var activity = DbSession
                .Include(projectId.ToId("project"))
                .Load<Activity>(activityId);

            var project = DbSession
                .Load<Project>(projectId);

            if (activity == null || activity.Project.ToIdentifier() != projectId)
                return new HttpNotFoundResult();

            var timelog = activity.Timelogs.Where(t => t.Id == model.Id).FirstOrDefault();
            timelog.Date = model.Date;
            timelog.Description = model.Description;
            timelog.Duration = model.Duration;

            var result = timelog.MapTo<RegisterTimelogsViewModel.Timelog>();
            result.Activity = activity.MapTo<EntityViewModel>();
            result.Project = project.MapTo<EntityViewModel>();

            return new JsonNetResult {Data = result};
        }