function bindPrescriptionItemEntityArray($prescriptionItemEntitys)
{
    $prescriptionItemDtos = new PrescriptionItemListDto();
    $prescriptionItemDtoArray = array();
    foreach ($prescriptionItemEntitys as $prescriptionItemEntity => $value) {
        array_push($prescriptionItemDtoArray, bindPrescriptionItemEntity($value));
    }
    $prescriptionItemDtos->setPrescriptionItems($prescriptionItemDtoArray);
    return $prescriptionItemDtos;
}
    $prescriptionItemsArray = array();
    foreach ($prescriptionItemListDto->getPrescriptionItems() as $prescriptionItemDto) {
        $prescriptionItemEntity = bindPrescriptionItemDto($prescriptionItemDto);
        $entityManager->persist($prescriptionItemEntity);
        $entityManager->flush();
        array_push($prescriptionItemsArray, bindPrescriptionItemEntity($prescriptionItemEntity));
    }
    $prescriptionItemListDto = new PrescriptionItemListDto();
    $prescriptionItemListDto->setPrescriptionItems($prescriptionItemsArray);
    $prescriptionItemListDto->printData($app);
});
$app->put('/prescriptionitems/:id', function ($id) use($app) {
    global $entityManager;
    $prescriptionItemEntity = $entityManager->find("PrescriptionItemEntity", $id);
    $entityManager->flush();
    $prescriptionItemDto = bindPrescriptionItemEntity($prescriptionItemEntity);
    $prescriptionItemDto->printData($app);
});
$app->delete('/prescriptionitems/:id', function ($id) use($app) {
    global $entityManager;
    $prescriptionItemEntity = $entityManager->find("PrescriptionItemEntity", $id);
    $entityManager->remove($prescriptionItemEntity);
    $entityManager->flush();
});
/*Referances*/
function getprescriptionItemQueryArray($app)
{
    $queryArray = array();
    $prescriptionItemId = $app->request()->get('prescriptionItemId');
    if ($prescriptionItemId != null) {
        $queryArray['prescriptionItemId'] = $prescriptionItemId;