public ModelObservableValidation(TViewModel model, Func <TViewModel, IObservable <bool> > validityObservable, Func <TViewModel, bool, ValidationText> messageFunc)
        {
            _disposables.Add(_lastValidationStateSubject.Do(s =>
            {
                _isValid = s.IsValid;
                _text    = s.Text;
            }).Subscribe());

            _validityConnectedObservable = Observable.Defer(() => validityObservable(model)).
                                           Select(v => new ValidationState(v, messageFunc(model, v), this)).
                                           Multicast(_lastValidationStateSubject);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ObservableValidationBase{TViewModel, TValue}"/> class.
        /// </summary>
        /// <param name="observable">Observable that updates the view model property validity.</param>
        protected ObservableValidationBase(IObservable <IValidationState> observable)
        {
            _isValidSubject
            .Do(state =>
            {
                _isValid = state.IsValid;
                _text    = state.Text;
            })
            .Subscribe()
            .DisposeWith(_disposables);

            _validityConnectedObservable = Observable
                                           .Defer(() => observable)
                                           .Multicast(_isValidSubject);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ModelObservableValidationBase{TViewModel}"/> class.
        /// </summary>
        /// <param name="viewModel">ViewModel instance.</param>
        /// <param name="validityObservable">Func to define if the viewModel is valid or not.</param>
        /// <param name="messageFunc">Func to define the validation error message based on the viewModel and validityObservable values.</param>
        protected ModelObservableValidationBase(
            TViewModel viewModel,
            Func <TViewModel, IObservable <bool> > validityObservable,
            Func <TViewModel, bool, ValidationText> messageFunc)
        {
            _lastValidationStateSubject
            .Do(state =>
            {
                _isValid = state.IsValid;
                _text    = state.Text;
            })
            .Subscribe()
            .DisposeWith(_disposables);

            _validityConnectedObservable = Observable
                                           .Defer(() => validityObservable(viewModel))
                                           .Select(v => new ValidationState(v, messageFunc(viewModel, v), this))
                                           .Multicast(_lastValidationStateSubject);
        }