A unifying theory in determining periodic families for Hamiltonian systems at resonance