function getByStationIdArray($id)
 {
     $siulf = new StationIncludeUserListFactory();
     $siulf->getByStationId($id);
     foreach ($siulf as $obj) {
         $list[$obj->getStation()] = NULL;
     }
     if (isset($list)) {
         return $list;
     }
     return array();
 }
 function setIncludeUser($ids)
 {
     Debug::text('Setting IDs...', __FILE__, __LINE__, __METHOD__, 10);
     if (is_array($ids)) {
         $tmp_ids = array();
         if (!$this->isNew()) {
             //If needed, delete mappings first.
             $lf_a = new StationIncludeUserListFactory();
             $lf_a->getByStationId($this->getId());
             foreach ($lf_a as $obj) {
                 $id = $obj->getIncludeUser();
                 Debug::text('IncludeUser ID: ' . $obj->getIncludeUser() . ' ID: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
                 //Delete users that are not selected.
                 if (!in_array($id, $ids)) {
                     Debug::text('Deleting: ' . $id, __FILE__, __LINE__, __METHOD__, 10);
                     $obj->Delete();
                 } else {
                     //Save ID's that need to be updated.
                     Debug::text('NOT Deleting : ' . $id, __FILE__, __LINE__, __METHOD__, 10);
                     $tmp_ids[] = $id;
                 }
             }
             unset($id, $obj);
         }
         //Insert new mappings.
         $lf_b = new UserListFactory();
         foreach ($ids as $id) {
             if (isset($ids) and !in_array($id, $tmp_ids)) {
                 $f = new StationIncludeUserFactory();
                 $f->setStation($this->getId());
                 $f->setIncludeUser($id);
                 $obj = $lf_b->getById($id)->getCurrent();
                 if ($this->Validator->isTrue('include_user', $f->Validator->isValid(), TTi18n::gettext('Selected Employee is invalid') . ' (' . $obj->getFullName() . ')')) {
                     $f->save();
                 }
             }
         }
         return TRUE;
     }
     Debug::text('No IDs to set.', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }