extract parts of controller to abstract class