/// <summary>
        /// Initializes the tracking configuration for a target object
        /// </summary>
        /// <param name="configuration"></param>
        public virtual void InitializeConfiguration(TrackingConfiguration configuration)
        {
            object target = configuration.TargetReference.Target;

            //set key if [TrackingKey] detected
            Type         targetType  = target.GetType();
            PropertyInfo keyProperty = targetType.GetProperties().SingleOrDefault(pi => pi.IsDefined(typeof(TrackingKeyAttribute), true));

            if (keyProperty != null)
            {
                configuration.Key = keyProperty.GetValue(target, null).ToString();
            }

            //add properties that have [Trackable] applied
            foreach (PropertyInfo pi in targetType.GetProperties())
            {
                TrackableAttribute propTrackableAtt = pi.GetCustomAttributes(true).OfType <TrackableAttribute>().Where(ta => ta.TrackerName == configuration.StateTracker.Name).SingleOrDefault();
                if (propTrackableAtt != null)
                {
                    //use [DefaultValue] if present
                    DefaultValueAttribute defaultAtt = pi.CustomAttributes.OfType <DefaultValueAttribute>().SingleOrDefault();
                    if (defaultAtt != null)
                    {
                        configuration.AddProperty(pi.Name, defaultAtt.Value);
                    }
                    else
                    {
                        configuration.AddProperty(pi.Name);
                    }
                }
            }

            //allow the object to alter its configuration
            ITrackingAware trackingAwareTarget = target as ITrackingAware;

            if (trackingAwareTarget != null)
            {
                trackingAwareTarget.InitConfiguration(configuration);
            }
        }
        internal TrackingConfiguration(object target, StateTracker tracker)
        {
            StateTracker         = tracker;
            this.TargetReference = new WeakReference(target);
            TrackedProperties    = new Dictionary <string, TrackedPropertyDescriptor>();
            AutoPersistEnabled   = true;
            AddMetaData();

            ITrackingAware trackingAwareTarget = target as ITrackingAware;

            if (trackingAwareTarget != null)
            {
                trackingAwareTarget.InitConfiguration(this);
            }

            ITriggerPersist asNotify = target as ITriggerPersist;

            if (asNotify != null)
            {
                asNotify.PersistRequired += (s, e) => Persist();
            }
        }