/*
         * private void UnRollView()
         * {
         *
         *  while (this.AfterStack.Count > 0)
         *  {
         *      this.AfterStack.Pop().Value.Execute();
         *  }
         * }*/

        private void UnRollRecord()
        {
            while (this.AfterStack.Peek().Key != EventActionEnum.CloseView)
            {
                StackCommand command = this.AfterStack.Peek().Value;
                command.Execute();
                this.AfterStack.Pop();
            }

            if (View.IsEmptyNewRecord() == false)
            {
                if (this.View.CurrentRecordId != 0 && this.View.IsDirty)
                {
                    this.View.SaveRecord(this.View.CurrentRecordId);
                }
            }
        }
        private void UnRollField()
        {
            EventActionEnum CurrentState = this.AfterStack.Peek().Key;

            switch (CurrentState)
            {
            case EventActionEnum.CloseField:
                StackCommand stackCommand = this.AfterStack.Pop().Value;
                if ((stackCommand.Identifier == CurrentField.Name && stackCommand.Event == "after") == false)
                {
                    stackCommand.Execute();
                }
                break;

            default:
                break;
            }
        }