[BUGFIX] Fix main relation between account and contacts

This bugfix fixes an issue, that a account-contact relation can be made "main" that previously existed, but was not main.

Also did some cleanups (moved functionality to manager)

__Tasks:__
- [x] cleanups
- [ ] get feedback

__Informations:__

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| Tests pass?   | yes
| Fixed tickets | none
| Doc           | none

php will throw a "Undefined index" Exception