Refactor records controller to use smaller methods