func (k Keeper) RemoveVendorProduct(ctx sdk.Context, vid uint16, pid uint16) {
	if !k.IsVendorProductsPresent(ctx, vid) {
		panic("VendorProducts does not exist")
	}
	store := ctx.KVStore(k.storeKey)
	vendorProducts := k.GetVendorProducts(ctx, vid)
	vendorProducts.RemoveVendorProduct(pid)
	if vendorProducts.IsEmpty() {
		store.Delete(types.GetVendorProductsKey(vid))
	} else {
		store.Set(types.GetVendorProductsKey(vid), k.cdc.MustMarshalBinaryBare(vendorProducts))
	}
}
Delete Product of Vendor.
package keeper
import (
	"github.com/cosmos/cosmos-sdk/codec"
	sdk "github.com/cosmos/cosmos-sdk/types"
	"github.com/zigbee-alliance/distributed-compliance-ledger/x/modelinfo/internal/types"
)
type Keeper struct {
	storeKey sdk.StoreKey
	cdc *codec.Codec
}
func NewKeeper(storeKey sdk.StoreKey, cdc *codec.Codec) Keeper {
	return Keeper{storeKey: storeKey, cdc: cdc}
}
func (k Keeper) GetModelInfo(ctx sdk.Context, vid uint16, pid uint16) types.ModelInfo {
	if !k.IsModelInfoPresent(ctx, vid, pid) {
		panic("ModelInfo does not exist")
	}
	store := ctx.KVStore(k.storeKey)
	bz := store.Get(types.GetModelInfoKey(vid, pid))
	var device types.ModelInfo
	k.cdc.MustUnmarshalBinaryBare(bz, &device)
	return device
}
func (k Keeper) SetModelInfo(ctx sdk.Context, model types.ModelInfo) {
	store := ctx.KVStore(k.storeKey)
	store.Set(types.GetModelInfoKey(model.VID, model.PID), k.cdc.MustMarshalBinaryBare(model))
	product := types.Product{
		PID:   model.PID,
		Name:  model.Name,
		SKU:   model.SKU,
		Owner: model.Owner,
	}
	k.AppendVendorProduct(ctx, model.VID, product)
}
func (k Keeper) DeleteModelInfo(ctx sdk.Context, vid uint16, pid uint16) {
	if !k.IsModelInfoPresent(ctx, vid, pid) {
		panic("ModelInfo does not exist")
	}
	store := ctx.KVStore(k.storeKey)
	store.Delete(types.GetModelInfoKey(vid, pid))
	k.RemoveVendorProduct(ctx, vid, pid)
}
func (k Keeper) IterateModelInfos(ctx sdk.Context, process func(info types.ModelInfo) (stop bool)) {
	store := ctx.KVStore(k.storeKey)
	iter := sdk.KVStorePrefixIterator(store, types.ModelInfoPrefix)
	defer iter.Close()
	for {
		if !iter.Valid() {
			return
		}
		val := iter.Value()
		var modelInfo types.ModelInfo
		k.cdc.MustUnmarshalBinaryBare(val, &modelInfo)
		if process(modelInfo) {
			return
		}
		iter.Next()
	}
}
func (k Keeper) CountTotalModelInfos(ctx sdk.Context) int {
	return k.countTotal(ctx, types.ModelInfoPrefix)
}
func (k Keeper) IsModelInfoPresent(ctx sdk.Context, vid uint16, pid uint16) bool {
	return k.isRecordPresent(ctx, types.GetModelInfoKey(vid, pid))
}
func (k Keeper) GetVendorProducts(ctx sdk.Context, vid uint16) types.VendorProducts {
	if !k.IsVendorProductsPresent(ctx, vid) {
		return types.NewVendorProducts(vid)
	}
	store := ctx.KVStore(k.storeKey)
	bz := store.Get(types.GetVendorProductsKey(vid))
	var vendorProducts types.VendorProducts
	k.cdc.MustUnmarshalBinaryBare(bz, &vendorProducts)
	return vendorProducts
}
func (k Keeper) AppendVendorProduct(ctx sdk.Context, vid uint16, product types.Product) {
	store := ctx.KVStore(k.storeKey)
	vendorProducts := k.GetVendorProducts(ctx, vid)
	vendorProducts.AddVendorProduct(product)
	store.Set(types.GetVendorProductsKey(vid), k.cdc.MustMarshalBinaryBare(vendorProducts))
}