How about moving this out of the records TableQuery to  for example the Records companion object?