public override async Task <IList <IEvent> > ProcessAction(int actionNumber)
        {
            ItemProcessor.InputData = InputData;
            if (actionNumber == 1)
            {
                return(new List <IEvent>()
                {
                    new CancelInputDialog(),
                    new ExecuteAction(ViewToShowAfterModify, ParametersToPassToViewAfterModify)
                });
            }
            else if (actionNumber == 0)
            {
                var itemId = GetValue("Id");

                var existingItem = ItemProcessor.RetrieveExistingItem();
                if ((IsNew && existingItem != null) || (!IsNew && existingItem != null && existingItem.Id != itemId))
                {
                    return(new List <IEvent>()
                    {
                        new ShowMessage("{0} already exists", ItemNameForDisplay)
                    });
                }

                var validationError = await ValidateInputs();

                if (validationError != null && validationError.Success == false)
                {
                    return(new List <IEvent>()
                    {
                        new ShowMessage(validationError.Message)
                    });
                }

                var result = await ItemProcessor.SaveOrUpdate(itemId);

                if (result.Success == false)
                {
                    return(new List <IEvent>()
                    {
                        new ShowMessage(result.Message)
                    });
                }

                var message = String.Format("{0} {1} successfully.", ItemNameForDisplay, IsNew ? "created" : "modified");
                if (!String.IsNullOrWhiteSpace(result.Message))
                {
                    message = result.Message;
                }

                return(new List <IEvent>()
                {
                    new ExecuteAction(ViewToShowAfterModify, ParametersToPassToViewAfterModify),
                    new CancelInputDialog(),
                    new ShowMessage(message),
                });
            }
            return(null);
        }