public ActivityGroup Cancelled(SingleActivity next)
        {
            if (next == null) throw new ArgumentNullException("next");

            OnCancel = next;
            return this;
        }
        public static SingleActivity Failed <T>(this SingleActivity activity,
                                                Expression <Func <T, Task <Activity> > > func)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }

            return(activity.Failed(Activity.Run(func)));
        }
        public static SingleActivity ExceptionFilter <TFilter>(this SingleActivity activity,
                                                               Expression <Action <ExceptionContext, TFilter> > filter)
        {
            if (activity == null)
            {
                throw new ArgumentNullException("activity");
            }
            if (filter == null)
            {
                throw new ArgumentNullException("filter");
            }

            activity.ExceptionFiltersList.Add(Dependable.ExceptionFilter.From(filter));
            return(activity);
        }
        static SingleActivity ThenCore <T>(Activity first, LambdaExpression func)
        {
            if (first == null)
            {
                throw new ArgumentNullException("first");
            }
            if (func == null)
            {
                throw new ArgumentNullException("func");
            }

            var method = func.ToMethodCall();
            var next   = new SingleActivity(typeof(T), method.Name, method.Arguments);

            return((SingleActivity)first.Then(next));
        }