/**
  * @Route("/", name="create_playlist")
  * @Method("POST")
  * @param Request $request
  * @return JsonResponse
  * @throws \Exception
  */
 public function createAction(Request $request)
 {
     $playlist = new Playlist();
     $form = $this->createForm(PlaylistType::class, $playlist);
     $form->handleRequest($request);
     $response = new JsonResponse();
     if ($form->isValid()) {
         $em = $this->getDoctrine()->getManager();
         $em->persist($playlist);
         $em->flush();
         $response->setData(array('id' => $playlist->getId(), 'name' => $playlist->getName()));
         return $response;
     }
     $response->isServerError();
     return $response;
 }