Optimize GetById. Fix more unit tests.