public void ExecuteCommand <TCommand>(object input)
            where TCommand : class
        {
            if (!ModelState.IsValid)
            {
                return;
            }
            var command = new CommandExecutionAdapter <TCommand>(ObjectFactory);

            command.SetInput(input);
            command.Execute();
            var result = command.TryToGetResult <IModifiesModelState>();

            if (result != null)
            {
                result.UpdateModelState(ModelState);
            }
        }
        public TResult ExecuteCommand <TCommand, TResult>()
            where TCommand : class
            where TResult : class
        {
            var command = new CommandExecutionAdapter <TCommand, TResult>(ObjectFactory);

            if (!ModelState.IsValid)
            {
                return(command.GetResult());
            }
            command.Execute();
            var result = command.GetResult();

            if (result != null && result is IModifiesModelState)
            {
                ((IModifiesModelState)result).UpdateModelState(ModelState);
            }
            return(result);
        }