public static ParametersSnapshot GetParameterSnapshotWithInnerObjects(this IParametrizedObject @this, string parentFieldName)
        {
            ParametersSnapshot result = @this.GetParametersSnapshot(parentFieldName);

            result.InnerSnapshots = @this
                                    .GetInnerParametrizedObjects()
                                    .Select(io => GetParameterSnapshotWithInnerObjects(io.ParametrizedObject, io.ParentFieldName))
                                    .ToArray();

            return(result);
        }
        public static void CopyParametersFromWithInnerObjects(this IParametrizedObject @this, IParametrizedObject other)
        {
            Contract.Requires(@this.GetType().Equals(other.GetType()));

            @this.CopyParametersFrom(other);

            foreach (var objectPair
                     in Enumerable.Zip(@this.GetInnerParametrizedObjects(), other.GetInnerParametrizedObjects(), (o1, o2) => new { O1 = o1, O2 = o2 }))
            {
                objectPair.O1.ParametrizedObject.CopyParametersFromWithInnerObjects(objectPair.O2.ParametrizedObject);
            }

            @this.ParametersChanged();
        }
        public static void SetParametersFromSnapshotWithInnerObjects(this IParametrizedObject @this, ParametersSnapshot snapshot)
        {
            @this.SetParametersFromSnapshot(snapshot);

            Dictionary <string, ParametersSnapshot> snapshots = snapshot.InnerSnapshots.ToDictionary(s => s.ParentFieldName, s => s);

            foreach (InnerParametrizedObject io in @this.GetInnerParametrizedObjects())
            {
                if (snapshots.ContainsKey(io.ParentFieldName))
                {
                    io.ParametrizedObject.SetParametersFromSnapshotWithInnerObjects(snapshots[io.ParentFieldName]);
                }
            }

            @this.ParametersChanged();
        }