Index: src/main/java/com/wediscussmovies/project/web/DesignFrontMovies.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/DesignFrontMovies.java	(revision 7f3655122036717700124fc482399ad0780bdf52)
+++ src/main/java/com/wediscussmovies/project/web/DesignFrontMovies.java	(revision 7f3655122036717700124fc482399ad0780bdf52)
@@ -0,0 +1,17 @@
+package com.wediscussmovies.project.web;
+
+import com.wediscussmovies.project.model.Movie;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DesignFrontMovies {
+    public static  void designMovieList(List<Movie> movieList, List<List<Movie>> movie_rows){
+        for(int i=0; i<movieList.size(); i+=4){
+            int j = i+4;
+            if(j>movieList.size())
+                j= movieList.size();
+            movie_rows.add(movieList.subList(i, j));
+        }
+    }
+}
Index: src/main/java/com/wediscussmovies/project/web/controller/MovieController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 2efe93e6443168a68d51579962ac90a4d618179b)
+++ src/main/java/com/wediscussmovies/project/web/controller/MovieController.java	(revision 7f3655122036717700124fc482399ad0780bdf52)
@@ -8,4 +8,5 @@
 import com.wediscussmovies.project.service.MovieService;
 import com.wediscussmovies.project.service.PersonService;
+import com.wediscussmovies.project.web.DesignFrontMovies;
 import lombok.Data;
 import org.springframework.format.annotation.DateTimeFormat;
@@ -47,20 +48,8 @@
         }
 
-        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
+        addModelPropertiesForUser(model);
 
-        if (!(auth instanceof AnonymousAuthenticationToken)){
-            UserDetails userDetails = (UserDetails) auth.getPrincipal();
-            User user = (User) userDetails;
-          model.addAttribute("likedMovies",this.movieService.findLikedMoviesByUser(user));
-          model.addAttribute("user",user);
-        }
-        List<Movie> movieList = movies;
         List<List<Movie>> movie_rows = new ArrayList<>();
-        for(int i=0; i<movieList.size(); i+=4){
-            int j = i+4;
-            if(j>movieList.size())
-                j=movieList.size();
-            movie_rows.add(movieList.subList(i, j));
-        }
+        DesignFrontMovies.designMovieList(movies,movie_rows);
         model.addAttribute("movies", movies);
         model.addAttribute("movie_rows", movie_rows);
@@ -74,13 +63,5 @@
     public String getMovie(@PathVariable Integer id, Model model){
         model.addAttribute("movie", movieService.findById(id));
-
-        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
-        if (!(auth instanceof AnonymousAuthenticationToken)){
-            UserDetails userDetails = (UserDetails) auth.getPrincipal();
-            User user = (User) userDetails;
-            model.addAttribute("likedMovies",this.movieService.findLikedMoviesByUser(user));
-            model.addAttribute("user",user);
-        }
-
+        addModelPropertiesForUser(model);
         model.addAttribute("contentTemplate", "movieShow");
         return "template";
@@ -184,3 +165,9 @@
         model.addAttribute("genres", genreService.findAll());
     }
+    private void addModelPropertiesForUser(Model model){
+        User user = LoggedUser.getLoggedUser();
+        model.addAttribute("likedMovies",this.movieService.findLikedMoviesByUser(user));
+        model.addAttribute("user",user);
+        }
+
 }
Index: src/main/java/com/wediscussmovies/project/web/controller/UsersController.java
===================================================================
--- src/main/java/com/wediscussmovies/project/web/controller/UsersController.java	(revision 2efe93e6443168a68d51579962ac90a4d618179b)
+++ src/main/java/com/wediscussmovies/project/web/controller/UsersController.java	(revision 7f3655122036717700124fc482399ad0780bdf52)
@@ -8,4 +8,5 @@
 import com.wediscussmovies.project.service.MovieService;
 import com.wediscussmovies.project.service.UserService;
+import com.wediscussmovies.project.web.DesignFrontMovies;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
@@ -65,10 +66,5 @@
         List<Movie> movieList = this.movieService.findLikedMoviesByUser(LoggedUser.getLoggedUser());
         List<List<Movie>> movie_rows = new ArrayList<>();
-        for(int i=0; i<movieList.size(); i+=4){
-            int j = i+4;
-            if(j>movieList.size())
-                j= movieList.size();
-            movie_rows.add(movieList.subList(i, j));
-        }
+        DesignFrontMovies.designMovieList(movieList,movie_rows);
         model.addAttribute("movie_rows", movie_rows);
         model.addAttribute("contentTemplate","favoriteList");
