public function findID(Query $query) {
        $pk = $this->getPrimaryKey();

        // Gather ID from where clause
        foreach ($query->getWhere()->getParams() as $param) {
            if ($param instanceof Expr && $param->getField() === $pk && in_array($param->getOperator(), ['=', 'in'])) {
                return $param->getValue();
            }
        }

        // Query for the ID then
        $select = clone $query;
        $results = array_values($select->setType(Query::SELECT)->fields($pk)->lists($pk, $pk, [
            'before' => false,
            'after' => false
        ]));

        if (count($results) > 1) {
            return $results;

        } else if (count($results) === 1) {
            return $results[0];
        }

        return null;
    }