Fixed code (p)review comments

In this commit I have fixed the comments of, at least, @akrabat
by renaming the Middleware to ServiceProvider, refactoring a jarring
method, removing ternaries and more smaller changes.
Remove direct instantiations on the EventApi
Re-arranged dependencies to be in the correct module
Moved last object instantations from EventApi to Middleware
Removed obsolete use statement
Refactor SearchApi to use new Client
Remove unused method