public function redirectTo($object)
    {
        $url = false;

        if ($this->getRequest()->get('btn_update_and_list')) {
            $url = $this->admin->generateUrl('list', ['active_tab' => $this->getRequest()->get('context')]);
        }
        if ($this->getRequest()->get('btn_create_and_list')) {
            $url = $this->admin->generateUrl('list', ['active_tab' => $this->getRequest()->get('context')]);
        }

        if ($this->getRequest()->get('btn_create_and_create')) {
            $params = [];
            if ($this->admin->hasActiveSubClass()) {
                $params['subclass'] = $this->getRequest()->get('subclass');
            }
            $url = $this->admin->generateUrl('create', $params);
        }

        if (!$url) {
            $url = $this->admin->generateObjectUrl('edit', $object);
        }

        return new RedirectResponse($url);
    }