Moved business logic into a service. I'm not sure about its name.
If you have a better idea let me know.