public static CommandAgent AsCommandAgent(this Task task)
        {
            if (task == null)
            {
                return(new CommandAgent());
            }
            var commandType = Ex.Dotnet.GetType(task.AssemblyName, task.TypeName);

            if (commandType == null)
            {
                return(null);
            }
            var command = Ex.Inject.Resolve(commandType) as Command;

            if (command == null)
            {
                return(null);
            }
            var agent = new CommandAgent(command);

            foreach (var item in task.Items)
            {
                agent.Map(CreateMapper(task, item));
            }
            return(agent);
        }