Refactored db table relations. ForeigKey and Through relations