public virtual ItemAttribute GetValue(ItemAttributes list, ItemAttribute ia)
        {
            ItemAttributes list2 = new ItemAttributes(ia.Cxt, ia.TableName, ia.ItemID, ia.AttributeID);

            foreach (ListItem li in Items)
            {
                bool contains = list2.Contains(ia.AttributeID, li.Value);

                if (li.Selected && !contains) // selected but no in db
                {
                    ItemAttribute.AddToList(list, ia.ItemID, ia.AttributeID, li.Value);
                }
                else if (!li.Selected && contains) // not selected but in db
                {
                    ItemAttribute iax = list2.Get(ia.AttributeID, li.Value);

                    list.DataTable.ImportRow(iax.DataRow);

                    DataRow row = list.DataTable.Rows[list.DataTable.Rows.Count - 1];

                    row.AcceptChanges();

                    row.Delete(); // mark deleted
                }
            }

            return null;
        }