public static EventProxy FromEvent(IEvent source)
        {
            IMedia     eventMedia = source.Media;
            MediaProxy mediaProxy = eventMedia == null ? null :
                                    eventMedia is IPersistentMedia?PersistentMediaProxy.FromMedia((IPersistentMedia)eventMedia) :
                                        MediaProxy.FromMedia(eventMedia);

            return(new EventProxy()
            {
                AudioVolume = source.AudioVolume,
                Duration = source.Duration,
                EventName = source.EventName,
                EventType = source.EventType,
                IdAux = source.IdAux,
                IdProgramme = source.IdProgramme,
                IsEnabled = source.IsEnabled,
                IsHold = source.IsHold,
                IsLoop = source.IsLoop,
                Layer = source.Layer,
                MediaGuid = source.MediaGuid,
                Media = eventMedia == null ? null : MediaProxy.FromMedia(eventMedia),
                RequestedStartTime = source.RequestedStartTime,
                ScheduledDelay = source.ScheduledDelay,
                ScheduledTc = source.ScheduledTc,
                ScheduledTime = source.ScheduledTime,
                StartTc = source.StartTc,
                StartTime = source.StartTime,
                StartType = source.StartType,
                TransitionTime = source.TransitionTime,
                TransitionPauseTime = source.TransitionPauseTime,
                TransitionType = source.TransitionType,
                TransitionEasing = source.TransitionEasing,
                SubEvents = source.AllSubEvents().Select(e => FromEvent(e)).ToArray(),
                IsCGEnabled = source.IsCGEnabled,
                Crawl = source.Crawl,
                Logo = source.Logo,
                Parental = source.Parental,
                AutoStartFlags = source.AutoStartFlags,
                Command = (source as ICommandScript)?.Command,
                Fields = source is ITemplated ? new Dictionary <string, string>(((ITemplated)source).Fields) : null,
                Method = source is ITemplated ? ((ITemplated)source).Method : TemplateMethod.Add,
                TemplateLayer = source is ITemplated ? ((ITemplated)source).TemplateLayer : -1,
            });
        }