public void AcceptChanges()
        {
            if (oldValue == null)
            {
                oldValue = (ChangeTrackedPOCO <TEntity>)Activator.CreateInstance(GetType());
            }

            CopyProperties(this, oldValue);
            GenerationsCounter++;
        }
        private static ChangeTrackedPOCO <TEntity> CopyProperties(ChangeTrackedPOCO <TEntity> source, ChangeTrackedPOCO <TEntity> target)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

            foreach (var sProp in source.GetType().GetProperties())
            {
                bool isMatched = target.GetType().GetProperties().Any(tProp => tProp.Name == sProp.Name && tProp.GetType() == sProp.GetType() && tProp.CanWrite);
                if (isMatched)
                {
                    var          value        = sProp.GetValue(source);
                    PropertyInfo propertyInfo = target.GetType().GetProperty(sProp.Name);
                    propertyInfo.SetValue(target, value);
                }
            }
            return(target);
        }