```scala
val enqueueEntries: Iterator[Option[QueueEntry.Task]] = itr.map {
  case Some(msg) => message2entry(msg, service)
  case None => None
}.collect {
  case Some(data: QueueEntry.Task) if !processed.remove(data.id) => Some(data)
  case None => None
}
```