public void SetStateConfirm()
        {
            Entity.PlanReceiptOrderPersonalAccounts.Where(x => x.State == PlanReceiptOrderPersonalAccountState.Close)
            .DoForEach(
                x =>
            {
                var manager =
                    new SetStateEntityManagerFactory <PlanReceiptOrderPersonalAccount, PlanReceiptOrderPersonalAccountState>(_repositoryFactory).Create();
                manager.SetState(x, PlanReceiptOrderPersonalAccountState.Confirm);
            });

            base.SetStateConfirm();
            if (_strategy != null)
            {
                _strategy.SetStateConfirm();
            }
        }
        public void SetState(PlanCertificate entity, PlanCertificateState newState, Sense behavior = Sense.Falling)
        {
            switch (entity.State)
            {
            case PlanCertificateState.NotСonfirm:
                _state = new NotСonfirmState(entity, _repositoryFactory);
                break;

            case PlanCertificateState.Confirm:
                if (behavior == Sense.Emerge)
                {
                    _state = new СonfirmStateEmerge(entity, _repositoryFactory);
                }

                if (behavior == Sense.Falling)
                {
                    _state = new СonfirmStateFalling(entity, _repositoryFactory);
                }

                if (behavior == Sense.Full)
                {
                    _state = new СonfirmStateFalling(entity, _repositoryFactory, new СonfirmStateEmerge(entity, _repositoryFactory));
                }

                break;

            case PlanCertificateState.Close:
                if (behavior == Sense.Emerge)
                {
                    _state = new СloseStateEmerge(entity, _repositoryFactory);
                }

                if (behavior == Sense.Falling)
                {
                    _state = new СloseStateFalling(entity, _repositoryFactory);
                }

                if (behavior == Sense.Full)
                {
                    _state = new СloseStateFalling(entity, _repositoryFactory, new СloseStateEmerge(entity, _repositoryFactory));
                }

                break;

            default:
                throw new CheckingSetStatePlanReceiptOrderInvalidException(
                          Resource.PCOStateNotExist.StringFormat(entity.Rn));
            }

            switch (newState)
            {
            case PlanCertificateState.NotСonfirm:
                _state.SetStateNotConfirm();
                break;

            case PlanCertificateState.Confirm:
                _state.SetStateConfirm();
                break;

            case PlanCertificateState.Close:
                _state.SetStateClose();
                break;

            default:
                throw new CheckingSetStatePlanReceiptOrderInvalidException(
                          Resource.PCOStateNotExist.StringFormat(entity.Rn));
            }
        }