move relation data to a class and do a basic wrapper for creating simple select queries