Refactor TimeSeriesDaoImpl by moving avg to a private method.