This is too much code for a controller method. Can you extract it out to a utility method, or do we need a controller just for the medication tracker?