/// <summary>
        /// Defines the shapes required for the part's main view.
        /// </summary>
        /// <param name="part">The part.</param>
        /// <param name="displayType">The display type.</param>
        /// <param name="shapeHelper">The shape helper.</param>
        protected override DriverResult Display(ActivityPart part, string displayType, dynamic shapeHelper)
        {
            var partSettings = part.Settings.GetModel <ActivityPartSettings>();

            DateTime?         localDateTimeStart = _dataLocalization.ReadDateLocalized(part.DateTimeStart);
            DateTime?         localDateTimeEnd   = _dataLocalization.ReadDateLocalized(part.DateTimeEnd);
            DateTime?         localDateRepeatEnd = _dataLocalization.ReadDateLocalized(part.RepeatEndDate);
            ActivityViewModel activityVM         = new ActivityViewModel();

            Mapper.Initialize(cfg => {
                cfg.CreateMap <ActivityPart, ActivityViewModel>()
                .ForMember(dest => dest.DateStart, opt => opt.Ignore())
                .ForMember(dest => dest.DateEnd, opt => opt.Ignore())
                .ForMember(dest => dest.TimeStart, opt => opt.Ignore())
                .ForMember(dest => dest.TimeEnd, opt => opt.Ignore())
                .ForMember(dest => dest.RepeatEndDate, opt => opt.Ignore())
                .ForMember(dest => dest.Monday, opt => opt.Ignore())
                .ForMember(dest => dest.Tuesday, opt => opt.Ignore())
                .ForMember(dest => dest.Wednesday, opt => opt.Ignore())
                .ForMember(dest => dest.Thursday, opt => opt.Ignore())
                .ForMember(dest => dest.Friday, opt => opt.Ignore())
                .ForMember(dest => dest.Saturday, opt => opt.Ignore())
                .ForMember(dest => dest.Sunday, opt => opt.Ignore())
                .ForMember(dest => dest.RepeatByDayNumber, opt => opt.Ignore())
                .ForMember(dest => dest.Settings, opt => opt.Ignore());
            });

            Mapper.Map(part, activityVM);

            activityVM.DateStart     = _dataLocalization.WriteDateLocalized(localDateTimeStart);
            activityVM.DateEnd       = _dataLocalization.WriteDateLocalized(localDateTimeEnd);
            activityVM.TimeStart     = _dataLocalization.WriteTimeLocalized(localDateTimeStart);
            activityVM.TimeEnd       = _dataLocalization.WriteTimeLocalized(localDateTimeEnd);
            activityVM.RepeatEndDate = _dataLocalization.WriteDateLocalized(part.RepeatEndDate);
            activityVM.Settings      = partSettings;
            if (part.RepeatType == "W")
            {
                activityVM.Monday    = part.RepeatDetails.Contains(DayOfWeek.Monday.ToString());
                activityVM.Tuesday   = part.RepeatDetails.Contains(DayOfWeek.Tuesday.ToString());
                activityVM.Wednesday = part.RepeatDetails.Contains(DayOfWeek.Wednesday.ToString());
                activityVM.Thursday  = part.RepeatDetails.Contains(DayOfWeek.Thursday.ToString());
                activityVM.Friday    = part.RepeatDetails.Contains(DayOfWeek.Friday.ToString());
                activityVM.Saturday  = part.RepeatDetails.Contains(DayOfWeek.Saturday.ToString());
                activityVM.Sunday    = part.RepeatDetails.Contains(DayOfWeek.Sunday.ToString());
            }
            else
            {
                activityVM.Monday    = false;
                activityVM.Tuesday   = false;
                activityVM.Wednesday = false;
                activityVM.Thursday  = false;
                activityVM.Friday    = false;
                activityVM.Saturday  = false;
                activityVM.Sunday    = false;
            }

            if (part.RepeatType == "M")
            {
                activityVM.RepeatByDayNumber = part.RepeatDetails.Contains("DayNum");
            }
            else
            {
                activityVM.RepeatByDayNumber = true;
            }

            return(ContentShape("Parts_ActivityDisplay",
                                () => shapeHelper.EditorTemplate(
                                    TemplateName: "Parts/ActivityDisplay",
                                    Model: activityVM,
                                    Prefix: Prefix)));
        }
 /// <summary>
 /// Get the UTC time from its local representation
 /// </summary>
 /// <param name="localDate">Local time</param>
 /// <returns>UTC-based time</returns>
 public DateTime DateToUTC(DateTime?localDate)
 {
     if (localDate == null || localDate.Value <= (DateTime)SqlDateTime.MinValue)
     {
         localDate = SqlDateTime.MinValue.Value.AddDays(1);
     }
     else if (localDate >= (DateTime)SqlDateTime.MaxValue)
     {
         localDate = SqlDateTime.MaxValue.Value.Subtract(TimeSpan.FromDays(1));
     }
     return((DateTime)(_dateServices.ConvertFromLocalizedString(_dateLocalization.WriteDateLocalized(localDate), _dateLocalization.WriteTimeLocalized(localDate))));
 }