func (r *InventoryItemRepo) Save(aggregate ycq.AggregateRoot, expectedVersion *int) error {
	return r.repo.Save(aggregate, expectedVersion)
}
Save persists an aggregate.
package simplecqrs
import (
	"fmt"
	"reflect"
	"github.com/jetbasrawi/go.cqrs"
	"github.com/jetbasrawi/go.geteventstore"
)
type InventoryItemRepo struct {
	repo *ycq.GetEventStoreCommonDomainRepo
}
func NewInventoryItemRepo(eventStore *goes.Client, eventBus ycq.EventBus) (*InventoryItemRepo, error) {
	r, err := ycq.NewCommonDomainRepository(eventStore, eventBus)
	if err != nil {
		return nil, err
	}
	ret := &InventoryItemRepo{
		repo: r,
	}
	aggregateFactory := ycq.NewDelegateAggregateFactory()
	aggregateFactory.RegisterDelegate(&InventoryItem{},
		func(id string) ycq.AggregateRoot { return NewInventoryItem(id) })
	ret.repo.SetAggregateFactory(aggregateFactory)
	streamNameDelegate := ycq.NewDelegateStreamNamer()
	streamNameDelegate.RegisterDelegate(func(t string, id string) string {
		return t + "-" + id
	}, &InventoryItem{})
	ret.repo.SetStreamNameDelegate(streamNameDelegate)
	eventFactory := ycq.NewDelegateEventFactory()
	eventFactory.RegisterDelegate(&InventoryItemCreated{},
		func() interface{} { return &InventoryItemCreated{} })
	eventFactory.RegisterDelegate(&InventoryItemRenamed{},
		func() interface{} { return &InventoryItemRenamed{} })
	eventFactory.RegisterDelegate(&InventoryItemDeactivated{},
		func() interface{} { return &InventoryItemDeactivated{} })
	eventFactory.RegisterDelegate(&ItemsRemovedFromInventory{},
		func() interface{} { return &ItemsRemovedFromInventory{} })
	eventFactory.RegisterDelegate(&ItemsCheckedIntoInventory{},
		func() interface{} { return &ItemsCheckedIntoInventory{} })
	ret.repo.SetEventFactory(eventFactory)
	return ret, nil
}
func (r *InventoryItemRepo) Load(aggregateType, id string) (*InventoryItem, error) {
	ar, err := r.repo.Load(reflect.TypeOf(&InventoryItem{}).Elem().Name(), id)
	if _, ok := err.(*ycq.ErrAggregateNotFound); ok {
		return nil, nil
	}
	if err != nil {
		return nil, err
	}
	if ret, ok := ar.(*InventoryItem); ok {
		return ret, nil
	}
	return nil, fmt.Errorf("Could not cast aggregate returned to type of %s", reflect.TypeOf(&InventoryItem{}).Elem().Name())
}