Check a Home's Insurance History

I'm shopping for a house and have heard that it can be difficult to get homeowners insurance if the house has a history of a lot of insurance claims. How can I avoid this kind of problem?