public ActionResult Create()
        {
            EventCreateViewModel eventCreateViewModel = new EventCreateViewModel();
            Event newEvent = new Event();

            eventCreateViewModel.Event = newEvent;
            eventCreateViewModel.EndDateTimeInput = null;
            eventCreateViewModel.StartDateTimeInput = null;

            //newEvent = EventEditorSetup(newEvent);
            return View(EventEditorSetupCreate(eventCreateViewModel));
        }
        public ActionResult Create(EventCreateViewModel eventCreateViewModel)
        {
            DoCreateEventValidation(eventCreateViewModel.Event);

            if (ModelState.IsValid)
            {
                int[] selectedCategories = eventCreateViewModel.Categories.Where(x => x.Selected).Select<SelectListItem, int>(x => Convert.ToInt32(x.Value.ToString())).ToArray<int>();
                eventCreateViewModel.Event.EventCategories.Clear();
                eventCreateViewModel.Event.EventCategories = unitOfWork.EventCategoryRepository.Get(x => selectedCategories.Contains(x.CategoryID)).ToArray();
                unitOfWork.EventRepository.Insert(eventCreateViewModel.Event);
                unitOfWork.Save();
                return RedirectToAction("Index");
            }

            //eventCreateViewModel.NewEvent = EventEditorSetup(eventCreateViewModel.NewEvent);
            return View(EventEditorSetupCreate(eventCreateViewModel));
        }
 private EventCreateViewModel EventEditorSetupCreate(EventCreateViewModel eventCreateViewModel)
 {
     eventCreateViewModel.ReoccurrenceFrames = unitOfWork.EventReoccurrenceFrameRepository.ReoccurrenceFrameKeyValueList();
     eventCreateViewModel.Categories = unitOfWork.EventCategoryRepository.CategoriesSelectListWithPreselected(eventCreateViewModel.Event.EventCategories);
     return eventCreateViewModel;
 }