refactor api controller, now should support child resources