private Task GetTask(BuildEventContext buildEventContext)
        {
            Target target = GetTarget(buildEventContext);

            if (target == null)
            {
                return(null);
            }

            var task = target.GetTaskById(buildEventContext.TaskId);

            return(task);
        }
        private Task GetTask(BuildEventContext buildEventContext)
        {
            if (buildEventContext.EqualTo(lastTaskBuildEventContext))
            {
                return(lastTask);
            }

            Target target = GetTarget(buildEventContext);

            if (target == null)
            {
                lastTaskBuildEventContext = null;
                return(null);
            }

            var task = target.GetTaskById(buildEventContext.TaskId);

            lastTaskBuildEventContext = buildEventContext;
            lastTask = task;
            return(task);
        }