public static function convertConfigHandlerToSidAgent()
 {
     \Bitrix\Sale\Delivery\Services\Manager::getHandlersList();
     $initedHandlersH = \Bitrix\Sale\Delivery\Services\Automatic::getRegisteredHandlers("HANDLER");
     $initedHandlersS = \Bitrix\Sale\Delivery\Services\Automatic::getRegisteredHandlers("SID");
     $filter = array('=CLASS_NAME' => '\\Bitrix\\Sale\\Delivery\\Services\\Automatic');
     $res = Bitrix\Sale\Delivery\Services\Table::getList(array('filter' => $filter, 'select' => array("ID", "CODE", "CONFIG")));
     while ($params = $res->fetch()) {
         if (!empty($params["CONFIG"]["MAIN"]["SID"])) {
             continue;
         }
         $config = $params["CONFIG"];
         if (!empty($initedHandlersH[$config["MAIN"]["HANDLER"]]["SID"])) {
             $config["MAIN"]["SID"] = $initedHandlersH[$config["MAIN"]["HANDLER"]]["SID"];
         } elseif (!empty($params["CODE"]) && !empty($initedHandlersS[$params["CODE"]])) {
             $config["MAIN"]["SID"] = $params["CODE"];
         } else {
             $config["MAIN"]["SID"] = "";
         }
         unset($config["MAIN"]["HANDLER"]);
         \Bitrix\Sale\Delivery\Services\Manager::update($params["ID"], array("CONFIG" => $config));
     }
     return "";
 }