Two miscarriages in a row. Advice?

I just found out I had my second miscarriage. Last time I found out at 9 weeks that I had a blighted ovum, this time at almost 9 weeks there was an embryo but no heartbeat. 
My doctor said I'm just unlucky, but I can't help but think something is wrong with me or my husband. Has anyone had successful pregnancies after two miscarriages? Or is there any recommended testing or something I can do to avoid this pain again? My doctor wasn't very helpful and I'm extremely sad and frustrated.