/// <summary>
        /// Handle the event
        /// </summary>
        /// <param name="initiatorplus"></param>
        /// <param name="trigger"></param>
        /// <returns>A list of actions generated by the leave created event</returns>
        public override List<WorkflowHandlerAction> Handle(WorkflowInitiatorPlus initiatorplus, object trigger)
        {
            var actions = new List<WorkflowHandlerAction>();

            //what do we want to do when a sickness is created?
            var leave = (Leave) initiatorplus.Initiator;

            //if created by a manager, then approval is implict?
            if (!leave.Approved)
            {
                //create an approval task. 
                var approval = new CreateProcessTaskActionModel
                                   {
                                       Title = "Approve Leave",
                                       AssignedRoles = new List<string> {Role.BuiltInRole.LineManager.ToString()},
                                       Description = "Review the Leave and Approve or Reject it",
                                       DueDate = DateTime.Now, //TODO: how much time should they have?
                                       TaskName = "Leave Approval",

                                   };
                actions.Add(new WorkflowHandlerAction
                                {
                                    Action = WorkflowHandlerAction.Actions.AddTask,
                                    ObjectType = "Task",
                                    NewObject = approval.ToJson(),
                                });
            }


            return actions; 
        }
        /// <summary>
        /// Handle the event
        /// </summary>
        /// <param name="initiatorplus">The initiator process (e.g. a sickness or leave) (and its children)</param>
        /// <param name="trigger">the object that triggered this event - as task in this case</param>
        /// <returns></returns>
        public override List<WorkflowHandlerAction> Handle(WorkflowInitiatorPlus initiatorplus, object trigger)
        {
            var actions = new List<WorkflowHandlerAction>();
            var config = (SicknessWorkflowConfiguration) WorkflowConfiguration;
            //what do we want to do when a sickness is created?
            var sickness = (Sickness) initiatorplus.Initiator;
            var welfarecall = (Task) trigger; 

            //create a welfare call. If sickness is not completed. 
            if (sickness.EndOfProcess == null)
            {
                var newwelfarecall = new CreateProcessTaskActionModel
                                         {
                                             Title = "Welfare Call for {0}",
                                             AssignedRoles = new List<string> { Role.BuiltInRole.LineManager.ToString() },
                                             Description = "Call {0} to check on their progress",
                                             DueDate = (welfarecall.CompletedDate ?? DateTime.Now).AddDays(config.WelfareCallDaysInterval),
                                             TaskName = "Welfare Call",

                                         };
                actions.Add(new WorkflowHandlerAction
                                {

                                    Action = WorkflowHandlerAction.Actions.AddTask,
                                    ObjectType = "Task",
                                    NewObject = newwelfarecall.ToJson(),
                                });
            }

            return actions; 
        }
        /// <summary>
        /// handle the sickness created event
        /// </summary>
        /// <param name="initiatorplus"></param>
        /// <param name="trigger">The object that triggered this event, in this case the sickness</param>
        /// <returns>A list of actions to be handled by this event</returns>
        public override List<WorkflowHandlerAction> Handle(WorkflowInitiatorPlus initiatorplus, object trigger)
        {
            var actions = new List<WorkflowHandlerAction>();

            //what do we want to do when a sickness is created?
            var sickness = (Sickness) initiatorplus.Initiator;

            var config = (SicknessWorkflowConfiguration) WorkflowConfiguration;
            if (sickness.EndOfProcess == null)
            {
                //create a welfare call task 
                var welfarecall = new CreateProcessTaskActionModel
                                      {
                                          Title = "Welfare Call for {0}",
                                          AssignedRoles = new List<string>{Role.BuiltInRole.LineManager.ToString()},
                                          Description = "Call {0} to check on their progress",
                                          DueDate =
                                              (sickness.StartOfProcess.AddDays(config.WelfareCallDaysInterval) < DateTime.Now
                                                   ? DateTime.Now
                                                   : sickness.StartOfProcess.AddDays(config.WelfareCallDaysInterval)),
                                          TaskName = "Welfare Call",

                                      };
                //add the task as a new action - in json format of course
                actions.Add(new WorkflowHandlerAction
                                {
                                    Action = WorkflowHandlerAction.Actions.AddTask, 
                                    ObjectType = "Task",
                                    NewObject = welfarecall.ToJson(), //the details of the tasks
                                });
            }


           actions.Add(new WorkflowHandlerAction
                           {
                               Action = WorkflowHandlerAction.Actions.NotifyActorsOfCreation
                           });


            return actions; 
        }