public function legacyUpdateOrderStateToNewBilledState($dateFrom, $statusOld, $statusNew)
    {
        $conditions = ['order_state' => $statusOld];
        if (!is_null($dateFrom)) {
            $conditions[] = 'DATE_FORMAT(created, \'%Y-%m-%d\') < \'' . Configure::read('app.timeHelper')->formatToDbFormatDate($dateFrom) . '\'';
        }
        $rows = $this->updateAll(
            [
                'order_state' => $statusNew
            ],
            $conditions
        );
        return $rows;
    }