private DataContainerViewModel CreatePatientDataModel(int patientNumber, string visitName, string formName)
        {
            Patient patient = patientRepository.GetPatientByUniqueNumber(patientNumber);
            if (patient == null)
                return new DataContainerViewModel {
                    Id = 0,
                    PatientNumber = patientRepository.GetMaxPatientNumber() + 1,
                    Children = new List<ConteinerChildViewModel>()
                };

            if (patient.Doctor.Login != User.Identity.Name)
                return null;

            var model = new DataContainerViewModel {
                Id = patient.Id,
                PatientCaption = patient.Caption,
                PatientNumber = patient.PatientNumber,
                PatientInitials = patient.PatientInitials,
                SelectedVisitName = visitName,
                SelectedFormName = formName,
                Children = new List<ConteinerChildViewModel>(
                    from v in patient.Visits
                    orderby v.OrderNo
                    select new ConteinerChildViewModel {
                        Id = v.Id,
                        Caption = v.Caption,
                        OrderNo = v.OrderNo
                    }
                    )
            };
            return model;
        }
        private DataContainerViewModel CreateVisitDataModel(int patientNumber, string visitName, string formName)
        {
            Visit visit = visitRepository.GetVisitByPatientNumberAndVisitName(patientNumber, visitName);
            if (visit == null)
                return null;

            var model = new DataContainerViewModel {
                Id = visit.Id,
                PatientNumber = patientNumber,
                SelectedVisitName = visitName,
                SelectedFormName = formName,
                Children = new List<ConteinerChildViewModel>(from form in visit.Forms
                                                             orderby form.OrderNo
                                                             select new ConteinerChildViewModel {
                                                             	Id = form.Id,
                                                             	Caption = form.Caption,
                                                             	OrderNo = form.OrderNo
                                                             })
            };
            return model;
        }