add and remove logic for adding key value pair for new