src/MamuzContact/Controller/CommandController.php
public function createAction()
    {
        /** @var \Zend\Http\PhpEnvironment\Request $request */
        $request = $this->getRequest();
        $prg = $this->prg($request->getRequestUri(), true);
        if ($prg instanceof ResponseInterface) {
            return $prg;
        } elseif ($prg === false) {
            return $this->viewModel;
        }

        if ($this->contactForm->setData($prg)->isValid()) {
            /** @var \MamuzContact\Entity\Contact $contact */
            $contact = $this->contactForm->getData();
            $this->commandService->persist($contact);
            $this->viewModel->setVariable('contact', $contact);
        }

        return $this->viewModel;
    }
public function createAction()
    {
        /** @var \Zend\Http\PhpEnvironment\Request $request */
        $request = $this->getRequest();
        $prg = $this->prg($request->getRequestUri(), true);
        if ($prg instanceof ResponseInterface) {
            return $prg;
        } elseif ($prg === false) {
            return $this->viewModel;
        }

        if ($this->contactForm->setData($prg)->isValid()) {
            /** @var \MamuzContact\Entity\Contact $contact */
            $contact = $this->contactForm->getData();
            $this->commandService->persist($contact);
            $this->viewModel->setVariable('contact', $contact);
        }

        return $this->viewModel;
    }
Persist contact entity

@return ModelInterface|ResponseInterface