change to use map instead of list in AbstractRepository where appropriate and other cleanup.