private string GetEventCategoryNamesCSV(EditEventViewModel model)
        {
            var selectedIds = model.SelectedEventCategoryIds.Split(',');
            var values = selectedIds.Select(
                selectedId => model.Categories.Where(x => x.Identifier == selectedId)
                    .Select(y => y.Name)
                    .FirstOrDefault()
                ).ToList();

            return string.Join(",", values);
        }
        public void UpdateContentItemFromModel(
            ContentItem item,
            EditEventViewModel model)
        {
            var part = item.As<EventPart>();

            if (model.ParentEventIdentifier != part.Identifier &&
                !string.IsNullOrWhiteSpace(model.ParentEventIdentifier))
                part.ParentEventIdentifier = model.ParentEventIdentifier;
            part.As<TitlePart>().Title = model.Title;
            part.Description = model.Description;
            part.AddressLocation = model.AddressLocation;
            part.TimeZone = model.TimeZone;
            part.RecurrenceId = model.RecurrenceId;
            part.RecurrenceRule = model.RecurrenceRule;
            part.RecurrenceException = model.RecurrenceException;
            part.ImportedFromGoogleCalendar = false;

            _categoryService.UpdateCategoriesForEvent(item, model.SelectedEventCategoryIds.Split(','));

            part.AllDayEvent = model.AllDayEvent;
            if (model.AllDayEvent)
            {
                model.StartDate = new DateTime(model.StartDate.Year, model.StartDate.Month, model.StartDate.Day);
                model.EndDate = new DateTime(model.EndDate.Year, model.EndDate.Month, model.EndDate.Day);
            }
            part.StartDate = model.StartDate;
            //part.StartDate = TimeZoneHelper.ConvertTZIDtoUTC(model.StartDate, model.TimeZone);
            part.EndDate = model.EndDate;
            //part.EndDate = TimeZoneHelper.ConvertTZIDtoUTC(model.EndDate, model.TimeZone);

            //set url if blank to autoroute alias
            part.Url = model.Url;
        }