Could the code in this method be placed somewhere else? It seems kind of long--especially for a controller method.