It sounds cold, but shit happens. You have to except the fact that people you care about die and there's nothing you can do to stop it. It doesn't make it hurt less but it helps you move on when you realize that. Only then can you focus on remembering all the good memories you have of the person and carry on with what you learned from them. Although the person is gone, they live on through all the lives that they have touched.
In high school there was 9 of us that were pretty close. Seven years later, there are only five of us left. Those losses have been very difficult. Two overdoses, a car accident and a murder, were unexpected and filled me with a lot of guilt and anger. Only after I was able to except that it wasn't my fault and made peace with myself could I remember them for the kind wonderful people that they were.