refactoring code and fixing issue with findByUserId. it now works when user has no photos to show