Just use functional programming, like in your example. In my opinion, Ecto schemas have no business in the controller.