/**
  * Assign device to me
  *
  * @param \Entity\Device $entity
  * @return Response
  */
 public function assign($entity)
 {
     if ($entity->getLocation()->getId() != $this->getUser()->getId()) {
         throw new DeviceNotFoundException();
     }
     if ($entity->getUser()) {
         throw new AlreadyHasOwnerException();
     }
     $entity->setUser($this->getUser());
     $this->flush();
     $response = new Response();
     $response->redirect('/device/location');
     return $response;
 }