Creating a flat table with models