public function finishPaletteCollection(&$collection = null)
    {
        if (!$this->paletteCollection) {
            throw new DcGeneralRuntimeException(
                'Palette collection is missing, please create a palette collection first'
            );
        }

        if ($this->palette) {
            $this->finishPalette();
        }

        $event = new FinishPaletteCollectionEvent($this->paletteCollection, $this);
        $this->dispatchEvent($event);
        $collection = $event->getPaletteCollection();

        $this->paletteCollection = null;

        return $this;
    }