This is one of the most confusing subject when we are studying German grammar. For each language that you study I will indicate to you one good procedure just to avoid these grammar and other learning problems:
1) Look what is main on this pharase language construction ( Verb, sustantives, Adjective, what? )
2) Do not compare all time with other languages. Sometimes we can but it will difficult us more and the reason is that, for example, each languages as well being similars or same family languageand origins but has their own properties and only will be undertandble to us when we absorve and receive this specific knowledge without subjections. Think: This language you are studying will not change and so, we must ( Wir müssen ) to adapt to it.
3) The other point and very important to consider is not thinking only on how understanding all of this language but how to introduce words, phrases,etc and using them daily with natives, at home , writting, recording your voice saying some phrases and compairing with natives ones sounds and correct ways. So acceptance is very important!
4) to say for you corrrectly if your phrase is correct or not we need to comprehend sometimes the context also and not only the grammatical points. This is the reason I can Indicate you that better than saying the first is correct or your second is to do that by your own you perceive that exists one rule for it and so look the webpage our friend gaves you and after think about some moment. Please, practice and acceptance is the best way to be better and dominate other languages rules. Please, look my message in box I will send you good exercises to help you.
I wait I helped you some!
My best wishes and regards, have a nice day and studies!