fix setRelated method and implement save dirty method for HasOne relation