dispatch when adding or updating an item