public function editDeliveryAction(Request $request, $id)
    {
        if($request->isXmlHttpRequest()){
            $em = $this->container->get('doctrine')->getManager();
            $user = $this->container->get('security.token_storage')->getToken()->getUser();
        
            /** @var Address $address */
            $address = $em->getRepository('EcommerceBundle:Address')->findOneBy(array(
                    'id'   => $id,
                    'actor' => $user,
                ));
            $form = $this->createForm('EcommerceBundle\Form\AddressType', $address, array('token_storage' => $this->container->get('security.token_storage')));

            if ('POST' === $request->getMethod()) {
                $form->handleRequest($request);

                if ($form->isValid()) {
                    $em->persist($address);
                    $em->flush();
                    $url = $this->container->get('router')->generate('core_actor_profile').'?delivery=1';
                    $this->container->get('session')->getFlashBag()->add('success', 'account.address.saved');
                    return new JsonResponse(array('status' => 'success', 'url' => $url));
                }else{
                    $template = $this->container->get('twig')->render("EcommerceBundle:Profile:Delivery/edit.html.twig", array(
                        'delivery_form' => $form->createView(),
                        'address' => $address
                    ));
                    return new JsonResponse(array('status' => 'error', 'answer' => $template));
                }
            }
        }else {
            throw new \Exception('Only by ajax');
        }
    }