Refactored the TypeRepository to be immutable.