public function getLastValidBlockItem(Block $block)
    {
        $dbHandler = $this->getConnection();
        $q = $dbHandler->createSelectQuery();
        $q
            ->select('object_id, node_id, priority, ts_publication, ts_visible, rotation_until, moved_to')
            ->from($dbHandler->quoteTable('ezm_pool'))
            ->where(
                $q->expr->eq('block_id', $q->bindValue($block->id)),
                $q->expr->gt('ts_visible', $q->bindValue(0, null, PDO::PARAM_INT)),
                $q->expr->eq('ts_hidden', $q->bindValue(0, null, PDO::PARAM_INT))
            )
            ->orderBy('ts_visible', SelectQuery::DESC)
            ->limit(1);

        $stmt = $q->prepare();
        $stmt->execute();
        $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
        if (empty($rows)) {
            return;
        }

        return $this->buildBlockItem(
            $rows[0] + array(
                'block_id' => $block->id,
                'ts_hidden' => 0,
            )
        );
    }