function bindTransactionServiceEntity($transactionServiceEntity)
{
    if ($transactionServiceEntity != null) {
        $transactionServiceDto = new TransactionServiceDto();
        $transactionServiceDto->setTransactionServiceId($transactionServiceEntity->getTransactionServiceId());
        $transactionServiceDto->setTransaction(bindTransactionEntity($transactionServiceEntity->getTransaction()));
        $transactionServiceDto->setService(bindServiceEntity($transactionServiceEntity->getService()));
        return $transactionServiceDto;
    } else {
        return null;
    }
}
    $transactionServiceListDto = new TransactionServiceListDto();
    $transactionServiceListDto = $transactionServiceListDto->bindXml($app);
    foreach ($transactionServiceListDto->getTransactionServices() as $transactionServiceDto) {
        $transactionServiceEntity = bindTransactionServiceDto($transactionServiceDto);
        $entityManager->persist($transactionServiceEntity);
        $entityManager->flush();
    }
});
$app->put('/transactionservices/:id', function ($id) use($app) {
    global $entityManager;
    $transactionServiceEntity = $entityManager->find("TransactionServiceEntity", $id);
    $entityManager->flush();
    $transactionServiceDto = bindTransactionServiceEntity($transactionServiceEntity);
    $transactionServiceDto->printData($app);
});
$app->post('/transactionservices', function () use($app) {
    global $entityManager;
    $transactionServiceDto = new TransactionServiceDto();
    $transactionServiceDto->bindJson($app);
    $entityManager->persist($transactionServiceEntity);
    $entityManager->flush();
    $transactionServiceDto = bindTransactionServiceEntity($transactionServiceEntity);
    $transactionServiceDto->printData($app);
});
$app->delete('/transactionservices/:id', function ($id) use($app) {
    global $entityManager;
    $transactionServiceEntity = $entityManager->find("TransactionServiceEntity", $id);
    $entityManager->remove($transactionServiceEntity);
    $entityManager->flush();
});
/*Referances*/