Change from in memory lists to sqlalchemy objects