private void ShowEditDetails( EventItemOccurrence eventItemOccurrence )
        {
            LinkageState = new EventItemOccurrenceGroupMap { Guid = Guid.Empty };

            if ( eventItemOccurrence == null )
            {
                eventItemOccurrence = new EventItemOccurrence();
            }

            if ( eventItemOccurrence.Id == 0 )
            {
                lActionTitle.Text = ActionTitle.Add( "Event Occurrence" ).FormatAsHtmlTitle();

                var copyFromOccurrenceId = PageParameter( "CopyFromId" ).AsInteger();
                if ( copyFromOccurrenceId > 0 )
                {
                    var oldOccurrence = new EventItemOccurrenceService( new RockContext() ).Get( copyFromOccurrenceId );
                    if ( oldOccurrence != null )
                    {
                        // clone the workflow type
                        eventItemOccurrence = oldOccurrence.Clone( false );
                        eventItemOccurrence.Schedule = oldOccurrence.Schedule;
                        eventItemOccurrence.EventItem = oldOccurrence.EventItem;
                        eventItemOccurrence.ContactPersonAlias = oldOccurrence.ContactPersonAlias;
                        eventItemOccurrence.CreatedByPersonAlias = null;
                        eventItemOccurrence.CreatedByPersonAliasId = null;
                        eventItemOccurrence.CreatedDateTime = RockDateTime.Now;
                        eventItemOccurrence.ModifiedByPersonAlias = null;
                        eventItemOccurrence.ModifiedByPersonAliasId = null;
                        eventItemOccurrence.ModifiedDateTime = RockDateTime.Now;
                        eventItemOccurrence.Id = 0;
                        eventItemOccurrence.Guid = Guid.NewGuid();

                        // Clone the linkage
                        var linkage = oldOccurrence.Linkages.FirstOrDefault();
                        if ( linkage != null )
                        {
                            LinkageState = linkage.Clone( false );
                            LinkageState.EventItemOccurrenceId = 0;
                            LinkageState.CreatedByPersonAlias = null;
                            LinkageState.CreatedByPersonAliasId = null;
                            LinkageState.CreatedDateTime = RockDateTime.Now;
                            LinkageState.ModifiedByPersonAlias = null;
                            LinkageState.ModifiedByPersonAliasId = null;
                            LinkageState.ModifiedDateTime = RockDateTime.Now;
                            LinkageState.Id = 0;
                            LinkageState.Guid = Guid.NewGuid();
                            LinkageState.RegistrationInstance = linkage.RegistrationInstance != null ? linkage.RegistrationInstance.Clone( false ) : new RegistrationInstance();
                            LinkageState.RegistrationInstance.RegistrationTemplate =
                                linkage.RegistrationInstance != null && linkage.RegistrationInstance.RegistrationTemplate != null ?
                                linkage.RegistrationInstance.RegistrationTemplate.Clone( false ) : new RegistrationTemplate();
                            LinkageState.Group = linkage.Group != null ? linkage.Group.Clone( false ) : new Group();
                        }
                    }
                }
            }
            else
            {
                lActionTitle.Text = ActionTitle.Edit( "Event Occurrence" ).FormatAsHtmlTitle();

                var registration = eventItemOccurrence.Linkages.FirstOrDefault();
                if ( registration != null )
                {
                    LinkageState = registration.Clone( false );
                    LinkageState.RegistrationInstance = registration.RegistrationInstance != null ? registration.RegistrationInstance.Clone( false ) : new RegistrationInstance();
                    LinkageState.RegistrationInstance.RegistrationTemplate =
                        registration.RegistrationInstance != null && registration.RegistrationInstance.RegistrationTemplate != null ?
                        registration.RegistrationInstance.RegistrationTemplate.Clone( false ) : new RegistrationTemplate();
                    LinkageState.Group = registration.Group != null ? registration.Group.Clone( false ) : new Group();
                }
            }

            SetEditMode( true );

            hfEventItemOccurrenceId.Value = eventItemOccurrence.Id.ToString();

            ddlCampus.SetValue( eventItemOccurrence.CampusId ?? -1 );
            tbLocation.Text = eventItemOccurrence.Location;

            if ( eventItemOccurrence.Schedule != null )
            {
                sbSchedule.iCalendarContent = eventItemOccurrence.Schedule.iCalendarContent;
                lScheduleText.Text = eventItemOccurrence.Schedule.FriendlyScheduleText;
            }
            else
            {
                sbSchedule.iCalendarContent = string.Empty;
                lScheduleText.Text = string.Empty;
            }

            ppContact.SetValue( eventItemOccurrence.ContactPersonAlias != null ? eventItemOccurrence.ContactPersonAlias.Person : null );
            pnPhone.Text = eventItemOccurrence.ContactPhone;
            tbEmail.Text = eventItemOccurrence.ContactEmail;

            htmlOccurrenceNote.Text = eventItemOccurrence.Note;

            DisplayRegistration();
        }