public async override Task <Result> ExportAsync(string fileName, CancellationToken cancellationToken)
        {
            using (var context = new ZvsContext(EntityContextConnection))
            {
                var existingSTs = await context.ScheduledTasks
                                  .ToListAsync(cancellationToken);

                var backupSTs = new List <ScheduledTaskBackup>();
                foreach (var t in existingSTs)
                {
                    var task = new ScheduledTaskBackup
                    {
                        StoredCommand = await StoredCmdBackup.ConvertToBackupCommand(t),
                        startTime     = t.StartTime,
                        Frequency     = (int)t.TaskType,
                        Name          = t.Name,
                        isEnabled     = t.IsEnabled,

                        DaysOfMonthToActivate = (int)t.DaysOfMonthToActivate,
                        DaysOfWeekToActivate  = (int)t.DaysOfWeekToActivate,

                        RecurDays    = t.RepeatIntervalInDays,
                        RecurMonth   = t.RepeatIntervalInMonths,
                        RecurSeconds = t.RepeatIntervalInSeconds,
                        RecurWeeks   = t.RepeatIntervalInWeeks,

                        sortOrder = t.SortOrder
                    };
                    backupSTs.Add(task);
                }

                var saveResult = await SaveAsXmlToDiskAsync(backupSTs, fileName);

                if (saveResult.HasError)
                {
                    return(Result.ReportError(saveResult.Message));
                }

                return(Result.ReportSuccessFormat("Exported {0} scheduled tasks to {1}", backupSTs.Count,
                                                  Path.GetFileName(fileName)));
            }
        }
        public async override Task<Result> ExportAsync(string fileName, CancellationToken cancellationToken)
        {
            using (var context = new ZvsContext(EntityContextConnection))
            {
                var existingSTs = await context.ScheduledTasks
                    .ToListAsync(cancellationToken);

                var backupSTs = new List<ScheduledTaskBackup>();
                foreach (var t in existingSTs)
                {
                    var task = new ScheduledTaskBackup
                    {
                        StoredCommand = await StoredCmdBackup.ConvertToBackupCommand(t),
                        startTime = t.StartTime,
                        Frequency = (int)t.TaskType,
                        Name = t.Name,
                        isEnabled = t.IsEnabled,

                        DaysOfMonthToActivate = (int)t.DaysOfMonthToActivate,
                        DaysOfWeekToActivate = (int)t.DaysOfWeekToActivate,

                        RecurDays = t.RepeatIntervalInDays,
                        RecurMonth = t.RepeatIntervalInMonths,
                        RecurSeconds = t.RepeatIntervalInSeconds,
                        RecurWeeks = t.RepeatIntervalInWeeks,

                        sortOrder = t.SortOrder

                    };
                    backupSTs.Add(task);
                }

                var saveResult = await SaveAsXmlToDiskAsync(backupSTs, fileName);

                if (saveResult.HasError)
                    return Result.ReportError(saveResult.Message);

                return Result.ReportSuccessFormat("Exported {0} scheduled tasks to {1}", backupSTs.Count,
                    Path.GetFileName(fileName));
            }
        }