public function find(array $criteria = [], array $options = [], $together = false)
    {
        $result = [];
        $this->joins = [];
        $this->queryParams = [];
        $this->selectColumns = $this->getPrimaryColumns();
        $this->groupColumns = ['t.delivery_execution_id'];
        $defaultOptions = [
            'order' => join(' ', [static::DEFAULT_SORT_COLUMN, static::DEFAULT_SORT_ORDER, static::DEFAULT_SORT_TYPE]),
            'offset' => 0,
            'asArray' => false
        ];
        $options = array_merge($defaultOptions, $options);

        $options['order'] = $this->prepareOrderStmt($options['order']);
        $fromClause = "FROM " . self::TABLE_NAME . " t ";

        $whereClause = $this->prepareCondition($criteria, $this->queryParams, $selectClause);
        if ($whereClause !== '') {
            $whereClause = 'WHERE ' . $whereClause;
        }
        $selectClause = "SELECT " . implode(',', $this->selectColumns);
        $sql = $selectClause . ' ' . $fromClause . PHP_EOL .
            implode(PHP_EOL, $this->joins) . PHP_EOL .
            $whereClause . PHP_EOL .
            'GROUP BY ' . implode(',', $this->groupColumns) . PHP_EOL;

        $sql .= "ORDER BY " . $options['order'];

        if (isset($options['limit']))  {
            $sql = $this->getPersistence()->getPlatForm()->limitStatement($sql, $options['limit'], $options['offset']);
        }

        $stmt = $this->getPersistence()->query($sql, $this->queryParams);

        $data = $stmt->fetchAll(\PDO::FETCH_ASSOC);

        if ($together) {
            $ids = array_column($data, static::COLUMN_ID);
            $kvData = $this->getKvData($ids);
            foreach ($data as &$row) {
                if (isset($kvData[$row[static::COLUMN_ID]])) {
                    $row = array_merge($row, $kvData[$row[static::COLUMN_ID]]);
                }
            }
            unset($row);
        }

        if ($options['asArray']) {
            $result = $data;
        } else {
            foreach($data as $row) {
                $deliveryExecution = ServiceProxy::singleton()->getDeliveryExecution($row[self::COLUMN_DELIVERY_EXECUTION_ID]);
                $result[] = $this->buildData($deliveryExecution, $row);
            }
        }

        return $result;
    }