I feel like the logic here is probably duplicated (either in another controller method, or in AdHocDataSet); maybe it can be consolidated.