public override int Run(String[] RemainingArguments)
        {
            IRavenEntity taskToFetch = new SparkTask();
            var actualTaskId = "SparkTasks/" + TaskId;
            taskToFetch.Id = actualTaskId;
            if (TaskId == null)
            {
                Console.WriteLine("Please specify an Id for the task to activate");
                return 0;
            }
            SparkTask taskToSet = SparkLogic.fetch(taskToFetch) as SparkTask;
            TaskStateControl taskStateControl = new TaskStateControl();
            ActiveTaskProcess taskProcessor = new ActiveTaskProcess();

            if (taskToSet == null)
            {
                Console.WriteLine("The task specified doesn't exist");
                return 0;
            }

            var result = taskStateControl.SetActiveTask(taskToSet);

            if (result == true) { Console.WriteLine("The task was activated"); }
            if (taskToSet != null && result == false)
            {
                taskStateControl.PauseTask();
                taskStateControl.SetActiveTask(taskToSet);
                Console.WriteLine("The Task was activated. The previous task was put on pause");
            }

            ReminderControl.StartTime = DateTime.Now;
            taskProcessor.SetStartTime();
            return 0;
        }
        public void ActivateReminders()
        {
            IRepository repo = new Repository();
            StartTime = DateTime.Now;
            ActiveTaskProcess taskProcessor = new ActiveTaskProcess();
            ReportWeekReminder reportWeekReminder = new ReportWeekReminder();
            DailyReminders dailyReminders = new DailyReminders();

            while (true)
            {

                Thread.Sleep(60000);
                SparkLogic.Initialize();
                var listOfReminders = SparkLogic.ReturnReminderList();

                var timeElapsed = DateTime.Now - StartTime;
                var activeTask = repo.GetActiveTask();

                if (activeTask != null)
                {
                    taskProcessor.AddElapsedTime();
                }

                foreach (Reminder reminder in listOfReminders)
                {

                    ReminderEventArgs eventArgs = new ReminderEventArgs(reminder, activeTask);
                    ReminderControl reminderControl = new ReminderControl();

                    if (timeElapsed.Minutes >= 1)
                    {
                        if (timeElapsed.Minutes % reminder.Interval == 0 && activeTask == null && reminder.Type == ReminderType.NoActiveTask)
                        {
                            reminderControl.OnEventNoActiveTask(eventArgs);
                        }
                        if (timeElapsed.Minutes % reminder.Interval == 0 && activeTask != null && reminder.Type == ReminderType.DefaultHourly)
                        {
                            reminderControl.OnEventIntervalPassed(eventArgs);
                        }
                        if (reminder.Type==ReminderType.EndOfWeek) { reportWeekReminder.RemindEndOfWeek(reminder); }
                        if (reminder.Type==ReminderType.StartOfWeek) { reportWeekReminder.RemindStartOfWeek(reminder); }
                        if (reminder.Type == ReminderType.StartOfDay) { dailyReminders.RemindStartOfDay(reminder); }
                        if (reminder.Type == ReminderType.EndOfDay) { dailyReminders.RemindEndOfDay(reminder); }
                    }
                }
            }
        }