Struggling With Bad Events

The past year has been a very difficult one. It seems that bad events continue to happen to me one after the other. Each time I experience a setback, I try and stay optimistic by telling myself that things will get better, and eventually they do. It’s just that as soon as I think things are starting to get better, I have another setback. This has continued for many months now. My question for you though revolves around the understanding of why bad things happen to us. I have struggled with a belief in a higher power for a long time, although I consider myself spiritual. I think I try to be a good person, and I am always trying to learn from my mistakes. I know that I am not perfect and I have certainly not been the best person my whole life. I just don’t understand why I have experienced so many really bad events over and over for the past year without a break. Is it karma, is the universe or God trying to tell me something? Everyone has their own theory, but I wanted to hear  yours. I want to learn from life, but I just don’t know how to “place” these events into my head so it makes sense. Am I missing the bigger picture? I appreciate any advice you are willing to offer.