public function add($vocabularyId)
    {
        $this->loadModel('Taxonomy.Vocabularies');
        $vocabulary = $this->Vocabularies->get($vocabularyId);
        $term = $this->Vocabularies->Terms->newEntity(['vocabulary_id' => $vocabulary->id], ['validate' => false]);
        $this->Vocabularies->Terms->addBehavior('Tree', ['scope' => ['vocabulary_id' => $vocabulary->id]]);

        if ($this->request->data()) {
            $term = $this->Vocabularies->Terms->patchEntity($term, $this->request->data, [
                'fieldList' => [
                    'parent_id',
                    'name',
                ]
            ]);

            if ($this->Vocabularies->Terms->save($term)) {
                $this->Flash->success(__d('taxonomy', 'Term has been created.'));
                if (!empty($this->request->data['action_vocabulary'])) {
                    $this->redirect(['plugin' => 'Taxonomy', 'controller' => 'terms', 'action' => 'vocabulary', $vocabulary->id]);
                } elseif (!empty($this->request->data['action_add'])) {
                    $this->redirect(['plugin' => 'Taxonomy', 'controller' => 'terms', 'action' => 'add', $vocabulary->id]);
                }
            } else {
                $this->Flash->danger(__d('taxonomy', 'Term could not be created, please check your information.'));
            }
        }

        $parentsTree = $this->Vocabularies->Terms
            ->find('treeList', ['spacer' => '--'])
            ->map(function ($link) {
                if (strpos($link, '-') !== false) {
                    $link = str_replace_last('-', '- ', $link);
                }

                return $link;
            });

        $this->title(__d('taxonomy', 'Create New Term'));
        $this->set(compact('vocabulary', 'term', 'parentsTree'));
        $this->Breadcrumb
            ->push('/admin/system/structure')
            ->push(__d('taxonomy', 'Taxonomy'), '/admin/taxonomy/manage')
            ->push(__d('taxonomy', 'Vocabularies'), ['plugin' => 'Taxonomy', 'controller' => 'vocabularies', 'action' => 'index'])
            ->push("\"{$vocabulary->name}\"", ['plugin' => 'Taxonomy', 'controller' => 'vocabularies', 'action' => 'edit', $vocabulary->id])
            ->push(__d('taxonomy', 'Terms'), ['plugin' => 'Taxonomy', 'controller' => 'terms', 'action' => 'vocabulary', $vocabulary->id])
            ->push(__d('taxonomy', 'Add new term'), '#');
    }