it might make sense to make this closure into a separately defined function that you could reuse between the get and post methods.