Resets previous photo collection

@param Collection $collection
176628
protected function clearPreviousCollection(Collection $collection)
    {
        if ($collection->count()) {
            foreach ($collection as $item) {
                $collection->removeElement($item);
            }
        }
    }
1006297
protected function persistCollection($collection)
    {
        $cache = new FilesystemAdapter($this->namespace);
        $item = $cache->getItem('collection');
        $item->set($collection);
        $cache->save($item);
    }
833499
public function collections(array $collections) : void {
        foreach ($collections as $name => $callback) {
            $this->make($name, $callback);
        }
    }
45724
public function setCollection(array $collection)
    {
        if (is_array($this->buildItems) 
                && array_key_exists('collection', $this->buildItems) 
                && !empty($this->buildItems['collection'])) {
            unset($this->collection);
        }
        $this->setBuildItems();
        foreach ($collection as $builder) {
            $this->addBuilder($builder);
        }
        
        return $this;
    }
224449
protected function postCollectionModifiers(Collection $collection)
    {
        if ($this->getOrderByField() && $this->getOrderByDirection()) {
            $field = $this->getOrderByField();
            $desc  = false;

            if ($this->getOrderByDirection() === 'desc') {
                $desc = true;
            }

            $sorted = $collection->sortBy(function ($entry) use ($field) {
                if (property_exists($entry, $field)) {
                    return $entry->{$field};
                }
            }, SORT_NATURAL, $desc);

            return $sorted;
        }

        return $collection;
    }
555720
public function setCollection($collection)
    {
        if (!$this->loaded) {
            $this->load();
        }

        $this->collectionInfo->setCollection($collection);
        return $this;
    }
556146
public function editCollection($collection_id = null)
    {
        $this->setCollection($collection_id);
        $this->setTitleEditCollection();
        $this->setBreadcrumbEditCollection();

        $this->setData('types', $this->collection->getTypes());
        $this->setData('collection', $this->data_collection);
        $this->setData('can_delete', $this->canDeleteCollection());
        $this->setData('languages', $this->language->getList(array('enabled' => true)));

        $this->submitEditCollection();
        $this->outputEditCollection();
    }
576333
private function forgetCollection(Collection $collection)
    {
        $query_builder = $this->manager->createQueryBuilder();
        $query_builder
            ->delete(StackUsageRecord::class, 'r')
            ->where('r.collection_id = :collection_id')
            ->setParameter('collection_id', $collection->getCollectionID())
            ->getQuery()->execute();
    }
729238
public function removeCollection($id)
    {
        unset($this->_collections[$id]);
        $this->clearSchema();

        $this->getLogger()->debug('Collection removed', array('collection' => $id));

        return $this;
    }
1133928
private function removeFromCollection(&$collection, $items)
    {
        if (is_array($collection)) {
            foreach ($items as $item) {
                foreach ($collection as $index => $v) {
                    if (spl_object_hash($item) == spl_object_hash($v)) {
                        unset($collection[$index]);
                    }
                }
            }
        } else {
            foreach ($items as $item) {
                $collection->removeElement($item);
            }
        }
    }
8247
public function loadCollection(PersistentCollection $collection)
    {
        $this->getDocumentPersister(get_class($collection->getOwner()))->loadCollection($collection);
    }
94985
public function schemaCollection(SchemaCollection $collection = null)
    {
        deprecationWarning(
            'Connection::schemaCollection() is deprecated. ' .
            'Use Connection::setSchemaCollection()/getSchemaCollection() instead.'
        );
        if ($collection !== null) {
            $this->setSchemaCollection($collection);
        }

        return $this->getSchemaCollection();
    }
889162
public function hasCollection($collection)
    {
        if (empty($this->queriesResultCache[ 'collectionNames' ])) {
            $this->getCollections();
        }

        return (bool)in_array($collection, $this->queriesResultCache[ 'collectionNames' ]);
    }
1006358
public function sync($collection)
    {
        foreach ($collection as $item) {
            $websiteId = $item->getWebsiteId();
            if ($this->helper->isEnabled($websiteId)) {
                $this->client = $this->engagementCloudAddressBookApiFactory->create()
                    ->setRequiredDataForClient($websiteId);
                $importData = $this->serializer->unserialize($item->getImportData());

                $this->syncItem($item, $importData, $websiteId);
            }
        }
        //update suppress status for contact ids
        if (!empty($this->suppressedContactIds)) {
            $this->contactResource->setContactSuppressedForContactIds($this->suppressedContactIds);
        }
    }
1177957
public function drop($collection)
    {
        if (!$this->collections->containsKey($collection)) {
            return false;
        }

        $this->collections->get($collection)->drop();
        $this->collections->remove($collection);

        return true;
    }
711337
private function AddSessionToConfig($collection)
	{
		if (is_array($collection))
		{
			foreach($collection as $key => $value)
			{
				$this->addPairToConfig('session.' . $key, $value);
			}
		}
	}
944128
public function apply(Collection $collection)
    {
        $this->collection = $collection;

        foreach ($this->filters() as $name => $value) {
            if (! method_exists($this, $name)) {
                continue;
            }

            if (is_array($value) or trim($value)) {
                $this->collection = $this->$name($value);
            } else {
                $this->collection = $this->$name();
            }
        }

        return $this->collection;
    }