public function addItem(Package $package, $item)
{
if (is_a($item, 'Newscoop\\Image\\LocalImage') && !$this->orm->contains($item)) {
$this->orm->persist($item);
$this->orm->flush($item);
}
if ($package->getRendition() !== null && is_a($item, 'Newscoop\\Image\\LocalImage') && !$package->getRendition()->fits($item)) {
throw new \InvalidArgumentException("Image too small.");
}
$packageItem = new Item($package, $item);
$this->orm->persist($packageItem);
$this->orm->flush();
return $packageItem;
}