Reset ip address in C#

I am trying to write a short c# app to solve the following problem. I have two network cards each with an IP address. when I try to set the IP of the 2nd adapter, the new IP conflicts with the one for the 1st adapter and therefore the IP and subset mask of the 2nd adapter are cleared out.

To solve the problem, is there a way in C# (using windows ManagementObject) to clear out the IP of the 1st adapter before I set the IP for the 2nd adapter to avoid conflicting? Or any other better ways?

I found a way to set the IP via ManagementObject in the question How to Change Public IP Address in C#, but do not know how to extend the method there to reset.