Encapsulate some controller methods

Encapsulate some controller methods into one function cause they have
the same parameters are the same.