Table view controller should handle this for you.