public void addItem(Item item, int count) { BackpackItem backpackItem = new BackpackItem(); backpackItem.Item = item; if (backpackRepository.contains(item.ItemName)) { backpackItem.increaseCount(count); backpackRepository.updateItem(backpackItem); } else { backpackItem.Count = count; backpackRepository.addItem(backpackItem); } }