Update ItemType programmatically

hi i want to update item type  which is iterated in for loop i write below code for that
for(int k=0;k<ir;k++)
{
  string itid= itarray[k].ToString();
  Item balItem1 = inn.newItem("bal_item","get");
  balItem1.setAttribute("id",itid);
  Item resbalItem1 = balItem1.apply();
  int iLockStatusItem=resbalItem1.getLockStatus();
  if (iLockStatusItem == 1 || iLockStatusItem==0)
  {
    if(iLockStatusItem==0)
    {
      resbalItem1.lockItem();
    }
    resbalItem1=resbalItem1.apply("update");
    resbalItem1.unlockItem();
  }
}
it gives error -An item with same key has already been added
Parents Reply Children
No Data