public function putAction(Request $request, int $id)
    {
        try {
            $em = $this->getDoctrine()->getManager();

            $entity = $em->getRepository($this->entityClassName())->find($id);

            $data = json_decode($request->getContent(), true);

            $request->setMethod('PATCH'); //Treat all PUTs as PATCH
            $form = $this->createForm($this->formClassName(), $entity, [
                "method" => $request->getMethod(),
            ]);

            $form->submit($data);

            if ($form->isValid()) {
                $em->flush();

                return $entity;
            }

            return FOSView::create(array('errors' => $form->getErrors()), Response::HTTP_INTERNAL_SERVER_ERROR);
        } catch (\Exception $e) {
            return FOSView::create($e->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
        }
    }