/// <summary>
        /// Adds the specified activity types
        /// </summary>
        /// <param name="configurator"></param>
        /// <param name="types">The state machine types to add</param>
        public static void AddActivities(this IRegistrationConfigurator configurator, params Type[] types)
        {
            IEnumerable <Type> activityTypes           = types.Where(x => x.HasInterface(typeof(Activity <,>)));
            IEnumerable <Type> activityDefinitionTypes = types.Where(x => x.HasInterface(typeof(IActivityDefinition <, ,>)));

            var activities = from c in activityTypes
                             join d in activityDefinitionTypes on c equals d.GetClosingArguments(typeof(IActivityDefinition <, ,>)).First() into dc
                             from d in dc.DefaultIfEmpty()
                             select new { ActivityType = c, DefinitionType = d };

            foreach (var activity in activities)
            {
                configurator.AddActivity(activity.ActivityType, activity.DefinitionType);
            }

            IEnumerable <Type> executeActivityTypes           = types.Where(x => x.HasInterface(typeof(ExecuteActivity <>))).Except(activityTypes);
            IEnumerable <Type> executeActivityDefinitionTypes = types.Where(x => x.HasInterface(typeof(IExecuteActivityDefinition <,>)));

            var executeActivities = from c in executeActivityTypes
                                    join d in executeActivityDefinitionTypes on c equals d.GetClosingArguments(typeof(IExecuteActivityDefinition <,>)).First() into dc
                                    from d in dc.DefaultIfEmpty()
                                    select new { ActivityType = c, DefinitionType = d };

            foreach (var executeActivity in executeActivities)
            {
                configurator.AddExecuteActivity(executeActivity.ActivityType, executeActivity.DefinitionType);
            }
        }
 /// <summary>
 /// Adds an execute activity (Courier), allowing configuration when it is configured on the endpoint.
 /// </summary>
 /// <param name="configurator"></param>
 /// <param name="configure"></param>
 /// <typeparam name="TActivity">The activity type</typeparam>
 /// <typeparam name="TArguments">The argument type</typeparam>
 /// <typeparam name="TDefinition">The activity definition type</typeparam>
 /// <returns></returns>
 public static IExecuteActivityRegistrationConfigurator <TActivity, TArguments> AddExecuteActivity <TActivity, TArguments, TDefinition>(
     this IRegistrationConfigurator configurator, Action <IExecuteActivityConfigurator <TActivity, TArguments> > configure = null)
     where TActivity : class, IExecuteActivity <TArguments>
     where TArguments : class
     where TDefinition : class, IExecuteActivityDefinition <TActivity, TArguments>
 {
     return(configurator.AddExecuteActivity(typeof(TDefinition), configure));
 }