Hadith - Sahih Bukhari 4:621, Narrated Abu Huraira
Allah's Apostle said, "Adam and Moses argued with each other. Moses said to Adam, 'You are Adam whose mistake expelled you from Paradise.' Adam said to him, 'You are Moses whom Allah selected as His Messenger and as the one to whom He spoke directly; yet you blame me for a thing which had already been written in my fate before my creation?' " Allah's Apostle said twice, "So, Adam overpowered Moses."
Allah tests us in this world Humans are diferent from angels in one regard that we have been given authority to act according to our wish but what result comes is from Allah. We can not attribute result of any act to humans. Humans are free to take decissions and apreciate other's support and pay back but can not say the goodness is because of our acts the reason behind this is that Allah is the best knower and knows the reason of bad or good which happens to us. We dont know it, so say Allah knows best whatever good or bad happened to us instead of saying such and such thing happened because of such and such act or reason.
Read event of "Prophet Musa and Khidr" Surah 18: 60-82