Even if it is not related to us, but why don't you create some helpers instead of repeating all the code over and over again?