public PartialViewResult NodeDetails(string id, string nodeType)
        {
            //Thread.Sleep(1000);
            ViewBag.Subjects = JournalContext.Subjects.ToArray();
            ViewBag.Teachers = JournalContext.Teachers.ToArray();
            ViewBag.Parents = JournalContext.Parents.ToArray();
            int userId;
            int.TryParse(id, out userId);
            switch (nodeType)
            {
                case JsTreeNodeType.PupilClass:
                    var classEntity = JournalContext.Journals.First(c => c.JournalID == int.Parse(id));
                    return PartialView(@"_ClassDetails", classEntity);
                case JsTreeNodeType.Pupil:
                    var userDetails = JournalContext.Pupils.First(ud => ud.PupilID == userId);
                    return PartialView(@"_PupilDetails", userDetails);
                case JsTreeNodeType.Teacher:
                    var teacher = JournalContext.Teachers.First(t => t.TeacherID == userId);
                    return PartialView(@"_TeacherDetails", teacher);
                case JsTreeNodeType.TimetableDayOfWeek:
                    var ids = id.Split(new []{'/'}, StringSplitOptions.RemoveEmptyEntries);
                    var dayOfWeek = int.Parse(ids[0]);
                    var journalId = int.Parse(ids[1]);

                    var lessonList = new List<JournalLesson>();
                    for (int order = 0; order < 8; ++order)
                    {
                        var lesson = JournalContext.JournalLessons.FirstOrDefault(l => l.Order == order && l.DayOfWeek == dayOfWeek && l.JournalID == journalId);
                        if (lesson == null)
                        {
                            lesson = new JournalLesson();
                            lesson.Order = order;
                            lesson.DayOfWeek = dayOfWeek;
                            lesson.JournalID = journalId;
                        }
                        lessonList.Add(lesson);
                    }
                    return PartialView(@"_CreateTimetable", lessonList);
                case "register_new_user":
                    var registerModel = new RegisterModel();
                    var password = GeneratePassword();
                    registerModel.Password = password;
                    registerModel.ConfirmPassword = password;
                    registerModel.UserName = GenerateUserName();
                    registerModel.DateOfBirth = DateTime.Now;
                    registerModel.SendEmail = true;
                    return PartialView(@"_Register", registerModel);
                case JsTreeNodeType.Quarters:
                    return PartialView("_Quarters", GetOrCreateQuareters().ToArray());
                case JsTreeNodeType.Schedule:
                    return PartialView("_Schedule", GetOrCreateSchedule().ToArray());
            }
            return new PartialViewResult();
        }
 partial void DeleteJournalLesson(JournalLesson instance);
 partial void UpdateJournalLesson(JournalLesson instance);
 partial void InsertJournalLesson(JournalLesson instance);
		private void detach_JournalConcreteLessons(JournalLesson entity)
		{
			this.SendPropertyChanging();
			entity.Journal = null;
		}
		private void attach_JournalConcreteLessons(JournalLesson entity)
		{
			this.SendPropertyChanging();
			entity.TeacherSubject = this;
		}