When is it legitimate to leave a church?

It is a sad reality of the world in which we live that sometimes people leave churches. In my experience, the vast majority of times