public function resolve()
    {
        $this->template = $this->createTemplate($this->templateClass);
        $this->template->setZones($this->zones);

        $this->assertEntityIsValid($this->template, array('Template', 'creation'));

        $this->eventDispatcher->addListener(
            TemplateEvents::TEMPLATE_CREATED,
            $handler = array($this, 'onTemplateCreated')
        );
        $this->fireEvent(
            TemplateEvents::TEMPLATE_CREATED,
            new TemplateEvent($this->template, $this)
        );
        $this->eventDispatcher->removeListener(TemplateEvents::TEMPLATE_CREATED, $handler);

        return $this->template;
    }