Merge contacts logic