Personally would have kept this in a different controller - Eg, OphanApi