You don't need to call with_connection twice on these two lines.  Reuse the connection.