async importQuotation(req: Request, res: Response, next: NextFunction) {
  try {
    console.log("Importing quotations...");
    const body: ImportCleanQuotations = req.body;
    const regionCode = getRegionCode(req.user!, req.query);
    if (!regionCode) {
      console.log("Region code is required for this operation");
      return res
        .status(httpStatusCodes.BAD_REQUEST)
        .json(
          new ResponseJSON(
            "Region code is required for this operation",
            true,
            httpStatusCodes.BAD_REQUEST
          )
        );
    }
    const items = await Promise.all(
      body.quotations.map((quotation) =>
        prisma.item.findUnique({
          where: {
            code: quotation.itemCode,
          },
          select: {
            UoMCode: true,
            SmUCode: true,
          },
        })
      )
    );
    console.log("Items: ", items);
    const createMany = await prisma.$transaction(async (tx) => {
      const quotations = await Promise.all(
        body.quotations.map((quotation, index) => {
          (quotation as any).status = QuotationStatus.BRANCH_APPROVED;
          (quotation as any).creationStatus =
            QuotationCreationStatus.IMPORTED;
          if (!quotation.collectorId) quotation.collectorId = req.user!.id;
          console.log("Quotation: ", quotation);
          return tx.quotation.create({
            data: {
              questionnaireId: quotation.questionnaireId,
              collectorId: req.user!.id,
              itemCode: quotation.itemCode,
              marketplaceCode: quotation.marketplaceCode!,
              quotes: {
                createMany: {
                  data: quotation.quotes!.map((quote, index) => ({
                    ...quote,
                    shopContactName: "Imported",
                    shopContactPhone: "Imported",
                    shopLatitude: "Imputated",
                    shopLongitude: "Imputated",
                    measurementUnit: items[index]!.UoMCode,
                  })),
                },
                // quotation.quotes?.map((quote) => { return {...quote,quantity: items[index]?.measurementQuantity,
                // measurmentId: items[index]?.measurement,};}),
              },
            },
            select: {
              id: true,
              questionnaireId: true,
              itemCode: true,
              quotes: true,
            },
          });
        })
      );

      await Promise.all(
        quotations.reduce((acc: any, quotation, index) => {
          acc.push(
            tx.interpolatedQuote.create({
              data: {
                quoteId: quotation.quotes[index].id,
                quotationId: quotation.id,
                price: quotation.quotes[index].price,
                measurementUnit: items[index]!.SmUCode,
                quantity: quotation.quotes[index].quantity,
              },
            })
          );
          acc.push(
            tx.cleanedQuote.create({
              data: {
                quoteId: quotation.quotes[index].id,
                quotationId: quotation.id,
                price: quotation.quotes[index].price,
                measurementUnit: items[index]!.SmUCode,
                quantity: quotation.quotes[index].quantity,
                questionnaireId: quotation.questionnaireId,
                itemCode: quotation.itemCode,
              },
            })
          );
          return acc;
        }, [])
      );

      await tx.itemRegionalMean.createMany({
        data: body.geomeans.map((mean) => ({
          itemCode: mean.itemCode,
          variation: mean.variation,
          stdev: mean.stdev,
          geomean: mean.geomean,
          min: mean.min,
          max: mean.max,
          questionnaireId: mean.questionnaireId,
          regionCode,
        })),
      });

      return quotations;
    });

    console.log("Quotations created: ", createMany);
    return res
      .status(httpStatusCodes.OK)
      .json(
        new ResponseJSON(
          "Quotations Created",
          false,
          httpStatusCodes.OK,
          createMany
        )
      );
  } catch (error) {
    console.log("Error --- ", error);
    next(
      apiErrorHandler(
        error,
        req,
        errorMessages.INTERNAL_SERVER,
        httpStatusCodes.INTERNAL_SERVER
      )
    );
  }
}
this function keeps throwing internal server error on the following  input {
    "quotations" : [
 {
            "itemCode": 101010101,
            "questionnaireId": 17,
            "marketplaceCode": 2010101,
            "quotes": [
                {
                    "price": 13,
                    "quantity": 325,
                    "shopContactName": "imported",
                    "shopContactPhone": "imported"
                },
                {
                    "price": 13.41,
                    "quantity": 325,
                    "shopContactName": "imported",
                    "shopContactPhone": "imported"
                }
            ]
        }
    ],
    "geomeans": [
{
            "itemCode": 101010101,
            "variation": 0.14,
            "stdev": 1.93,
            "geomean": 13.99,
            "min": 11.47,
            "max": 16.53,
            "questionnaireId": 17
        }
    ]
} Importing quotations...
User {
  id: 4,
  fullName: 'new stat',
  userName: 'newstat',
  email: 'newstat@gmail.com',
  emailVerified: false,
  phoneNumber: '251978563412',
  role: 4362,
  accountLockedOut: false,
  accessFailedCount: 0,
  disabled: false,
  registrantId: 2,
  tokenExpireAfter: 5184000,
  createdAt: 2023-05-17T11:07:23.908Z,
  updatedAt: 2023-05-17T11:07:23.908Z,
  marketplaceCode: null,
  tempRole: null,
  language: 'en',
  tempRoleEndDate: null,
  supervisorId: null,
  branchCode: null,
  regionCode: 14
}
RegionCode:  14
Items:  [ { UoMCode: 'g', SmUCode: 'g' } ]
Quotation:  {
  itemCode: 101010101,
  questionnaireId: 17,
  marketplaceCode: 2010101,
  quotes: [
    {
      price: 13,
      quantity: 325,
      shopContactName: 'imported',
      shopContactPhone: 'imported'
    },
    {
      price: 13.41,
      quantity: 325,
      shopContactName: 'imported',
      shopContactPhone: 'imported'
    }
  ],
  status: 'BRANCH_APPROVED',
  creationStatus: 'IMPORTED',
  collectorId: 4
}
Error ---  TypeError: Cannot read property 'UoMCode' of undefined
    at /home/user/Documents/projects-r/360-dev/ess-backend/ess-backend/src/Controllers/StatisticianController.ts:1188:54
    at Array.map (<anonymous>)
    at /home/user/Documents/projects-r/360-dev/ess-backend/ess-backend/src/Controllers/StatisticianController.ts:1182:45
    at Array.map (<anonymous>)
    at /home/user/Documents/projects-r/360-dev/ess-backend/ess-backend/src/Controllers/StatisticianController.ts:1168:27
    at Generator.next (<anonymous>)
    at /home/user/Documents/projects-r/360-dev/ess-backend/ess-backend/src/Controllers/StatisticianController.ts:8:71
    at new Promise (<anonymous>)
    at __awaiter (/home/user/Documents/projects-r/360-dev/ess-backend/ess-backend/src/Controllers/StatisticianController.ts:4:12)
    at /home/user/Documents/projects-r/360-dev/ess-backend/ess-backend/src/Controllers/StatisticianController.ts:1166:65 {
  clientVersion: '4.3.1'
} the above function throws this error how can i fix it ? update the above code so that it filters items which my not have a corresponding code and checks for null or undefined and skip those items so that the function doesnt break