|  | @@ -119,7 +119,7 @@ namespace InABox.Core
 | 
	
		
			
				|  |  |      /// <summary>
 | 
	
		
			
				|  |  |      ///     Observable object with INotifyPropertyChanged implemented
 | 
	
		
			
				|  |  |      /// </summary>
 | 
	
		
			
				|  |  | -    public abstract class BaseObject : INotifyPropertyChanged, IBaseObject, IJsonOnDeserializing, IJsonOnDeserialized
 | 
	
		
			
				|  |  | +    public abstract class BaseObject : INotifyPropertyChanged, IBaseObject, IJsonOnDeserializing, IJsonOnDeserialized, IJsonOnSerialized, IJsonOnSerializing
 | 
	
		
			
				|  |  |      {
 | 
	
		
			
				|  |  |          public BaseObject()
 | 
	
		
			
				|  |  |          {
 | 
	
	
		
			
				|  | @@ -129,6 +129,7 @@ namespace InABox.Core
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          internal bool _disabledInterceptor;
 | 
	
		
			
				|  |  | +        private bool _deserialising;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          protected T InitializeField<T>(ref T? field, [CallerMemberName] string name = "")
 | 
	
		
			
				|  |  |              where T : BaseObject, ISubObject, new()
 | 
	
	
		
			
				|  | @@ -147,7 +148,7 @@ namespace InABox.Core
 | 
	
		
			
				|  |  |          [GetInterceptor]
 | 
	
		
			
				|  |  |          protected T GetValue<T>(Type propertyType, ref T field, string name)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            if (_disabledInterceptor) return field;
 | 
	
		
			
				|  |  | +            if (_disabledInterceptor || _deserialising) return field;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |              if(field is null && propertyType.HasInterface<ISubObject>() && !propertyType.IsAbstract)
 | 
	
		
			
				|  |  |              {
 | 
	
	
		
			
				|  | @@ -165,19 +166,50 @@ namespace InABox.Core
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          [SetInterceptor]
 | 
	
		
			
				|  |  | -        protected void SetValue<T>(ref T field, T newValue)
 | 
	
		
			
				|  |  | +        protected void SetValue<T>(Type propertyType, ref T field, string name, T newValue)
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | -            field = newValue;
 | 
	
		
			
				|  |  | +            if (_disabledInterceptor || !_deserialising)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                field = newValue;
 | 
	
		
			
				|  |  | +                return;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +            if(field is null && newValue is ISubObject subObj && !propertyType.IsAbstract)
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                subObj.SetLinkedParent(this);
 | 
	
		
			
				|  |  | +                subObj.SetLinkedPath(name);
 | 
	
		
			
				|  |  | +                if(subObj is BaseObject obj)
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    obj.SetObserving(_observing);
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +                field = newValue;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else
 | 
	
		
			
				|  |  | +            {
 | 
	
		
			
				|  |  | +                field = newValue;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public void OnSerializing()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            _disabledInterceptor = true;
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        public void OnSerialized()
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            _disabledInterceptor = false;
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public void OnDeserializing()
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            _deserialising = true;
 | 
	
		
			
				|  |  |              if (_observing)
 | 
	
		
			
				|  |  |                  SetObserving(false);
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          public void OnDeserialized()
 | 
	
		
			
				|  |  |          {
 | 
	
		
			
				|  |  | +            _deserialising = false;
 | 
	
		
			
				|  |  |              if (!_observing)
 | 
	
		
			
				|  |  |                  SetObserving(true);
 | 
	
		
			
				|  |  |          }
 |