public function updateGalleryItemPosition(Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        $posArray = $request->get('data');

        $i = 0;
        foreach ($posArray as $item) {
            $entity = $em->getRepository('AmulenMediaBundle:GalleryItem')->find($item);
            $entity->setPosition($i);
            $i++;
        }
        $em->flush();
        return new Response('ok');
    }