public static Schedule SaveSchedule(Schedule schedule)
 {
   using (IScheduleRepository scheduleRepository = new ScheduleRepository())
   {
     scheduleRepository.AttachEntityIfChangeTrackingDisabled(scheduleRepository.ObjectContext.Schedules, schedule);
     scheduleRepository.ApplyChanges(scheduleRepository.ObjectContext.Schedules, schedule);
     scheduleRepository.UnitOfWork.SaveChanges();        
     schedule.AcceptChanges();
   }
   ProgramManagement.SynchProgramStates(new ScheduleBLL(schedule));
   return schedule;
 }