public JsonResult RunNotificationsAlgorithm(int Id, int Period, bool Enable, bool OnStopError, bool Invoke)
        {
            string msg = "Enabled";
            if (Enable)
            {

                try
                {
                    int UNHour,   UNMinute;
                    DateTimeServices.GetTimeUniversal(9, 0,User.Identity.GetTimeZone(), out UNHour, out UNMinute);
                    RecurringJob.AddOrUpdate(Id.ToString(), () => EmploymentPapers.RunNotificationsAlgorithm(System.Configuration.ConfigurationManager.ConnectionStrings["HrContext"].ConnectionString,Language), Cron.Daily(UNHour,UNMinute));
                }
                catch
                {
                    if (OnStopError)
                        RecurringJob.RemoveIfExists(Id.ToString());
                }


                if (!Invoke)
                {
                    RecurringJob.Trigger(Id.ToString());
                    EmploymentPapers _EmploymentPapers = new EmploymentPapers(HrUnitOfWork);
                    _EmploymentPapers.UpdateTimeofTask(Id,Language);
                }
            }
            else
                msg = "Disabled";
            return Json(msg, JsonRequestBehavior.AllowGet);

           
        }