public override void Write(object obj, ES2Writer writer)
 {
     Devdog.InventorySystem.Models.InventoryItemReferenceSaveLookup data = (Devdog.InventorySystem.Models.InventoryItemReferenceSaveLookup)obj;
     // Add your writer.Write calls here.
     writer.Write(data.referenceOfCollection);
     writer.Write(data.itemID);
     writer.Write(data.amount);
 }
	public override object Read(ES2Reader reader)
	{
        Devdog.InventorySystem.Models.InventoryItemReferenceSaveLookup data = new Devdog.InventorySystem.Models.InventoryItemReferenceSaveLookup();
		// Add your reader.Read calls here and return your object.
		data.referenceOfCollection = reader.Read<System.String>();
		data.itemID = reader.Read<System.Int32>();
		data.amount = reader.Read<System.UInt32>();

		return data;
	}
    public override object Read(ES2Reader reader)
    {
        Devdog.InventorySystem.Models.InventoryItemReferenceSaveLookup data = new Devdog.InventorySystem.Models.InventoryItemReferenceSaveLookup();
        // Add your reader.Read calls here and return your object.
        data.referenceOfCollection = reader.Read <System.String>();
        data.itemID = reader.Read <System.Int32>();
        data.amount = reader.Read <System.UInt32>();

        return(data);
    }
        public static InventoryItemReferenceSaveLookup[] GetCollectionReferenceLookups(ItemCollectionBase collection)
        {
            var l = new InventoryItemReferenceSaveLookup[collection.items.Length];
            for (int i = 0; i < collection.items.Length; i++)
            {
                if (collection.items[i].item == null)
                    l[i] = new InventoryItemReferenceSaveLookup(-1, 0, string.Empty);
                else
                    l[i] = new InventoryItemReferenceSaveLookup((int)collection.items[i].item.ID, collection.items[i].item.currentStackSize, collection.items[i].item.itemCollection.collectionName);
            }

            return l;
        }