add api logic to controller