Upsert a dictionary item

Creates or updates a key-value pair within a specific dictionary.