protected function addOrEditObject($data = [], $redirect = TRUE)
	{
		try {
			if ($this->detailObject) {
				// Edit object
				$this->canUser('edit');
				$this->mainManager->edit($this->detailObject->id, $data);
				$this->flashMessage('Object saved');

			} else {
				// Add object
				$this->canUser('add');
				$this->mainManager->add($data);
				$this->flashMessage('Object added');
			}

		} catch (\Exception $e) {
			$this->flashMessage('Upps.', 'error');
		}

		if ($redirect) {
			$this->redirect('default');
		}

	}