Big code cleanup & optimization

Moved all repository CRUD methods to the base repository, moved all
entity-linq extensions to one generic linq extension.