app/controllers/DestinationsController.java
@Security.Authenticated(SecureSession.class)
    public CompletionStage<Result> unfollow(Http.Request request, Integer profileId, int destId, boolean isPublic) {
        Integer profId = SessionController.getCurrentUserId(request);
        return profileRepository.findById(profId).thenApplyAsync(profile -> {
            if (profile.isPresent()) {
                Optional<ArrayList<Integer>> followedTemp = destinationRepository.unfollowDestination(destId, profileId);
                try {
                    followedDestinationIds = followedTemp.get();
                } catch (NoSuchElementException e) {
                    followedDestinationIds = new ArrayList<>();
                }
                if (!isPublic) {
                    Optional<ArrayList<Destination>> destListTemp = profileRepository.getDestinations(profileId, 0);
                    int limit = abs(7 - destinationsList.size());
                    Optional<ArrayList<Destination>> followedListTemp = destinationRepository.getFollowedDestinations(profileId, 0, limit);
                    try {
                        destinationsList = destListTemp.get();
                        destinationsList.addAll(followedListTemp.get());
                    } catch (NoSuchElementException e) {
                        destinationsList = new ArrayList<>();
                    }
                }

                destinationsList = loadCurrentUserDestinationPhotos(profileId, destinationsList);
                destinationsList = loadWorldDestPhotos(profileId, destinationsList);
                destinationsList = loadTravellerTypes(destinationsList);
                List<Photo> usersPhotos = getUsersPhotos(profile.get().getProfileId());
                return ok(destinations.render(destinationsList, profile.get(), isPublic,
                        initialisePaginiation(0, profileId, isPublic), followedDestinationIds, usersPhotos,
                        form, new RoutedObject<Destination>(null, false, false), requestForm,
                        Country.getInstance().getAllCountries(), searchForm, searchVal,  request,  messagesApi.preferred(request)));
            } else {
                return redirect(destShowRoute);
            }
        });
    }
/**
     * Method to unfollow a destination called from the destinations page and used from an endpoint
     *
     * @param profileId Id of the profile to unfollow destination
     * @param destId    Id of the destination to be unfollowed
     * @param isPublic  Boolean of the destination if is public or not
     */
Method to unfollow a destination called from the destinations page and used from an endpoint
@param profileId Id of the profile to unfollow destination
@param destId    Id of the destination to be unfollowed
@param isPublic  Boolean of the destination if is public or not
Method to unfollow a destination called from the destinations page and used from an endpoint @param profileId Id of the profile to unfollow destination @param destId Id of the destination to be unfollowed @param isPublic Boolean of the destination if is public or not
@Security.Authenticated(SecureSession.class)
    public CompletionStage<Result> unfollow(Http.Request request, Integer profileId, int destId, boolean isPublic) {
        Integer profId = SessionController.getCurrentUserId(request);
        return profileRepository.findById(profId).thenApplyAsync(profile -> {
            if (profile.isPresent()) {
                Optional<ArrayList<Integer>> followedTemp = destinationRepository.unfollowDestination(destId, profileId);
                try {
                    followedDestinationIds = followedTemp.get();
                } catch (NoSuchElementException e) {
                    followedDestinationIds = new ArrayList<>();
                }
                if (!isPublic) {
                    Optional<ArrayList<Destination>> destListTemp = profileRepository.getDestinations(profileId, 0);
                    int limit = abs(7 - destinationsList.size());
                    Optional<ArrayList<Destination>> followedListTemp = destinationRepository.getFollowedDestinations(profileId, 0, limit);
                    try {
                        destinationsList = destListTemp.get();
                        destinationsList.addAll(followedListTemp.get());
                    } catch (NoSuchElementException e) {
                        destinationsList = new ArrayList<>();
                    }
                }
                destinationsList = loadCurrentUserDestinationPhotos(profileId, destinationsList);
                destinationsList = loadWorldDestPhotos(profileId, destinationsList);
                destinationsList = loadTravellerTypes(destinationsList);
                List<Photo> usersPhotos = getUsersPhotos(profile.get().getProfileId());
                return ok(destinations.render(destinationsList, profile.get(), isPublic,
                        initialisePaginiation(0, profileId, isPublic), followedDestinationIds, usersPhotos,
                        form, new RoutedObject<Destination>(null, false, false), requestForm,
                        Country.getInstance().getAllCountries(), searchForm, searchVal,  request,  messagesApi.preferred(request)));
            } else {
                return redirect(destShowRoute);
            }
        });
    }
@ Security . Authenticated ( SecureSession . class ) public CompletionStage < Result > unfollow ( Http . Request request , Integer profileId , int destId , boolean isPublic ) { Integer profId = SessionController . getCurrentUserId ( request ) ; return profileRepository . findById ( profId ) . thenApplyAsync ( profile -> { if ( profile . isPresent ( ) ) { Optional < ArrayList < Integer > > followedTemp = destinationRepository . unfollowDestination ( destId , profileId ) ; try { followedDestinationIds = followedTemp . get ( ) ; } catch ( NoSuchElementException e ) { followedDestinationIds = new ArrayList < > ( ) ; } if ( ! isPublic ) { Optional < ArrayList < Destination > > destListTemp = profileRepository . getDestinations ( profileId , 0 ) ; int limit = abs ( 7 - destinationsList . size ( ) ) ; Optional < ArrayList < Destination > > followedListTemp = destinationRepository . getFollowedDestinations ( profileId , 0 , limit ) ; try { destinationsList = destListTemp . get ( ) ; destinationsList . addAll ( followedListTemp . get ( ) ) ; } catch ( NoSuchElementException e ) { destinationsList = new ArrayList < > ( ) ; } } destinationsList = loadCurrentUserDestinationPhotos ( profileId , destinationsList ) ; destinationsList = loadWorldDestPhotos ( profileId , destinationsList ) ; destinationsList = loadTravellerTypes ( destinationsList ) ; List < Photo > usersPhotos = getUsersPhotos ( profile . get ( ) . getProfileId ( ) ) ; return ok ( destinations . render ( destinationsList , profile . get ( ) , isPublic , initialisePaginiation ( 0 , profileId , isPublic ) , followedDestinationIds , usersPhotos , form , new RoutedObject < Destination > ( null , false , false ) , requestForm , Country . getInstance ( ) . getAllCountries ( ) , searchForm , searchVal , request , messagesApi . preferred ( request ) ) ) ; } else { return redirect ( destShowRoute ) ; } } ) ; }
Method to unfollow a destination called from the destinations page and used from an endpoint
 @param profileId Id of the profile to unfollow destination
 @param destId    Id of the destination to be unfollowed
 @param isPublic  Boolean of the destination if is public or not
Method to unfollow a destination called from the destinations page and used from an endpoint @param profileId Id of the profile to unfollow destination @param destId Id of the destination to be unfollowed @param isPublic Boolean of the destination if is public or not