Modelling the optical and electronic transport properties of AlGaAs and AlGaN intersubband devices and optimisation of quantum cascade laser active regions