Moved table logic to service