How does an IUI work ? Is it possible to have done with endo ? Would you try an IUI before trying Ivf?

K
Any info you know from a doctor would be helpful. Thanks.