function bindSessionServiceEntity($sessionServiceEntity)
{
    if ($sessionServiceEntity != null) {
        $sessionServiceDto = new SessionServiceDto();
        $sessionServiceDto->setSessionServiceId($sessionServiceEntity->getSessionServiceId());
        $sessionServiceDto->setSession(bindSessionEntity($sessionServiceEntity->getSession()));
        $sessionServiceDto->setService(bindServiceEntity($sessionServiceEntity->getService()));
        return $sessionServiceDto;
    } else {
        return null;
    }
}
    $sessionServiceListDto = new SessionServiceListDto();
    $sessionServiceListDto = $sessionServiceListDto->bindXml($app);
    foreach ($sessionServiceListDto->getSessionServices() as $sessionServiceDto) {
        $sessionServiceEntity = bindSessionServiceDto($sessionServiceDto);
        $entityManager->persist($sessionServiceEntity);
        $entityManager->flush();
    }
});
$app->put('/sessionservices/:id', function ($id) use($app) {
    global $entityManager;
    $sessionServiceEntity = $entityManager->find("SessionServiceEntity", $id);
    $entityManager->flush();
    $sessionServiceDto = bindSessionServiceEntity($sessionServiceEntity);
    $sessionServiceDto->printData($app);
});
$app->post('/sessionservices', function () use($app) {
    global $entityManager;
    $sessionServiceDto = new SessionServiceDto();
    $sessionServiceDto->bindJson($app);
    $entityManager->persist($sessionServiceEntity);
    $entityManager->flush();
    $sessionServiceDto = bindSessionServiceEntity($sessionServiceEntity);
    $sessionServiceDto->printData($app);
});
$app->delete('/sessionservices/:id', function ($id) use($app) {
    global $entityManager;
    $sessionServiceEntity = $entityManager->find("SessionServiceEntity", $id);
    $entityManager->remove($sessionServiceEntity);
    $entityManager->flush();
});
/*Referances*/