function createRecurringSchedule($company_id, $template_id, $start_date, $end_date, $user_ids)
 {
     $rscf = new RecurringScheduleControlFactory();
     $rscf->setCompany($company_id);
     $rscf->setRecurringScheduleTemplateControl($template_id);
     $rscf->setStartWeek(1);
     $rscf->setStartDate($start_date);
     $rscf->setEndDate($end_date);
     $rscf->setAutoFill(FALSE);
     if ($rscf->isValid()) {
         $rscf->Save(FALSE);
         if (isset($user_ids)) {
             $rscf->setUser($user_ids);
         }
         if ($rscf->isValid()) {
             $rscf->Save();
             Debug::Text('Saving Recurring Schedule...', __FILE__, __LINE__, __METHOD__, 10);
             return TRUE;
         }
     }
     return FALSE;
 }
     Debug::Text('Submit!', __FILE__, __LINE__, __METHOD__, 10);
     $rscf->setId($data['id']);
     $rscf->setCompany($current_company->getId());
     $rscf->setRecurringScheduleTemplateControl($data['template_id']);
     $rscf->setStartWeek($data['start_week']);
     $rscf->setStartDate($data['start_date']);
     $rscf->setEndDate($data['end_date']);
     if (isset($data['auto_fill'])) {
         $rscf->setAutoFill(TRUE);
     } else {
         $rscf->setAutoFill(FALSE);
     }
     if ($rscf->isValid()) {
         $rscf->Save(FALSE);
         if (isset($data['user_ids'])) {
             $rscf->setUser($data['user_ids']);
         }
         if ($rscf->isValid()) {
             $rscf->Save();
             Redirect::Page(URLBuilder::getURL(NULL, 'RecurringScheduleControlList.php'));
             break;
         }
     }
 default:
     if (isset($id)) {
         BreadCrumb::setCrumb($title);
         $rsclf = new RecurringScheduleControlListFactory();
         $rsclf->getByIdAndCompanyId($id, $current_company->getID());
         foreach ($rsclf as $rsc_obj) {
             //Debug::Arr($station,'Department', __FILE__, __LINE__, __METHOD__,10);
             $data = array('id' => $rsc_obj->getId(), 'template_id' => $rsc_obj->getRecurringScheduleTemplateControl(), 'start_week' => $rsc_obj->getStartWeek(), 'start_date' => $rsc_obj->getStartDate(), 'end_date' => $rsc_obj->getEndDate(), 'auto_fill' => $rsc_obj->getAutoFill(), 'user_ids' => $rsc_obj->getUser(), 'created_date' => $rsc_obj->getCreatedDate(), 'created_by' => $rsc_obj->getCreatedBy(), 'updated_date' => $rsc_obj->getUpdatedDate(), 'updated_by' => $rsc_obj->getUpdatedBy(), 'deleted_date' => $rsc_obj->getDeletedDate(), 'deleted_by' => $rsc_obj->getDeletedBy());