Using Data Mapper pattern in the data access layer instead of using the Active Record pattern.
New classes in the business layer responsible to access data. Removing from the controllers the process of accessing data.
Using the new classes responsible to access data.
Some changes in the comments.
The tests were failing because of the creation of the new route for the authentication.