protected function settingsAction(Request $request)
 {
     $app = $this->getApp($request);
     if (!$app->getStores()->count()) {
         $defaultStore = new Store();
         $defaultStore->setName('Default');
         $defaultStore->setApp($app);
         $app->addStore($defaultStore);
         $em = $this->getDoctrine()->getManager();
         $em->persist($defaultStore);
         $em->flush($defaultStore);
     }
     $form = $this->createForm(new ViewType($app), $this->getView($request));
     if ($request->getMethod() == 'POST') {
         $form->handleRequest($request);
         if ($form->isValid()) {
             $this->get('session')->getFlashBag()->add('success', 'Your changes were saved');
             $this->getDoctrine()->getManager()->flush();
         }
     }
     return ['form' => $form->createView(), 'appParams' => $this->getExtensionParameters($request)];
 }