protected void SendReport(TaskBase task, EventArgs<TaskException> args, string body, List<string> files,
                           string taskStatus)
 {
     var keyLine = args != null && !args.Value.Key.IsNullOrEmpty() ? " Key " + args.Value.Key : null;
     subject = "{0}:{1}.{2}".F(taskStatus, task.Description, keyLine);
     var attachment = args.IfNotNull(item => item.Value.Serialize());
     SendReport(body, attachment, args.IfNotNull(item => item.Value.Files));
 }
        /// <summary>
        ///     create array of parameters for message template
        ///     0 - DateTime.Now
        ///     1 task.Description
        ///     2 Status Message
        ///     3 Error Message
        ///     4 Inner Exception (with stack)
        ///     5 User
        /// </summary>
        /// <param name = "task"></param>
        /// <param name = "args"></param>
        /// <returns></returns>
        protected override object[] GetMessagePrameters(TaskBase task, EventArgs<TaskException> args)
        {
            var error = (args == null)
                            ? string.Empty
                            : (args.Value == null)
                                  ? string.Empty
                                  : args.Value.Message +
                                    (args.Value.InnerException == null
                                         ? string.Empty
                                         : args.Value.InnerException.Message);
            var result = new object[]
            {
                DateTime.Now, task.Description, task.Status.StatusMessage, error,
                args.IfNotNull(val => val.Value).IfNotNull(val => val.InnerException),
                Config.Instance.WebService.Login
            };

            return result;
        }