/**
  * Updates the access_url_rel_session table with a given user list
  * @author Julio Montoya
  * @param array user list
  * @param int access_url_id
  * */
 public static function update_urls_rel_session($session_list, $access_url_id)
 {
     $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
     $sql = "SELECT session_id FROM {$table_url_rel_session} WHERE access_url_id=" . intval($access_url_id);
     $result = Database::query($sql);
     $existing_sessions = array();
     while ($row = Database::fetch_array($result)) {
         $existing_sessions[] = $row['session_id'];
     }
     // Adding users
     foreach ($session_list as $session) {
         if (!in_array($session, $existing_sessions)) {
             if (!empty($session) && !empty($access_url_id)) {
                 UrlManager::add_session_to_url($session, $access_url_id);
             }
         }
     }
     // Deleting old users
     foreach ($existing_sessions as $existing_session) {
         if (!in_array($existing_session, $session_list)) {
             if (!empty($existing_session) && !empty($access_url_id)) {
                 UrlManager::delete_url_rel_session($existing_session, $access_url_id);
             }
         }
     }
 }