private static PocoFrame ToPoco(this IFrame source, ConversionContext context) { if (source == null) return null; var poco = source as PocoFrame; if ((poco != null) || context.GetOrCreate(source, () => new PocoFrame(), out poco)) return poco; source.CopyTo(poco, nameof(IFrame.FrameChildren), nameof(IFrame.FrameTransitions)); foreach (IFrameItem child in source.FrameChildren) if (child is IFrameText) poco.Texts.Add(child as PocoFrameText ?? ((IFrameText) child).ToPoco(context)); else if (child is IFrameImage) poco.Images.Add(child as PocoFrameImage ?? ((IFrameImage) child).ToPoco(context)); else if (child is IFrameVideo) poco.Videos.Add(child as PocoFrameVideo ?? ((IFrameVideo) child).ToPoco(context)); else if (child is IFrame) poco.Frames.Add(child as PocoFrame ?? ((IFrame) child).ToPoco(context)); return poco; }