Refactoring code related to updating ContactsBox