Debug::Text('DepartmentBranchId: ' . $branch_id, __FILE__, __LINE__, __METHOD__, 10);
                if (isset($id)) {
                    //Get User ID's from database.
                    $dbulf = new DepartmentBranchUserListFactory();
                    $dbulf->getByDepartmentBranchId($department_branch->getId());
                    $department_branch_user_ids = array();
                    foreach ($dbulf as $department_branch_user) {
                        $department_branch_user_ids[] = $department_branch_user->getUser();
                        Debug::Text('DepartmentBranchUser: '******'s.
                    $department_branch_user_ids = $department_data['branch_data'][$branch_id];
                }
                $blf = new BranchListFactory();
                $blf->getById($branch_id);
                $branch = $blf->getIterator()->current();
                $branch_data[$branch_id] = array('id' => $branch->getId(), 'name' => $branch->getName(), 'user_ids' => $department_branch_user_ids);
            }
            $department_data = array('id' => $department->getId(), 'company_name' => $current_company->getName(), 'status' => $department->getStatus(), 'name' => $department->getName(), 'branch_list' => $department->getBranch(), 'branch_data' => $branch_data, 'created_date' => $department->getCreatedDate(), 'created_by' => $department->getCreatedBy(), 'updated_date' => $department->getUpdatedDate(), 'updated_by' => $department->getUpdatedBy(), 'deleted_date' => $department->getDeletedDate(), 'deleted_by' => $department->getDeletedBy());
        }
        //Select box options;
        $department_data['branch_list_options'] = BranchListFactory::getByCompanyIdArray($current_company->getId());
        //$ulf = new UserListFactory;
        $department_data['user_options'] = UserListFactory::getByCompanyIdArray($current_company->getId(), FALSE);
        //var_dump($te);
        $smarty->assign_by_ref('department_data', $department_data);
        break;
}
$smarty->assign_by_ref('dbuf', $dbuf);
$smarty->display('department/EditDepartmentBranchUser.tpl');