Index: app/Http/Controllers/Dashboard/DepartmentsController.php
===================================================================
--- app/Http/Controllers/Dashboard/DepartmentsController.php	(revision 94f05dcdae6255fd3aa74c6925f9286ee591bb91)
+++ app/Http/Controllers/Dashboard/DepartmentsController.php	(revision df6e9ecdf8595d3dfec8137afae9a415164b1717)
@@ -119,10 +119,10 @@
     public function downloadAll()
     {
-        $zip_file=Storage::disk('uploads')->path('Departments.zip');
-        $zip = new \ZipArchive();
-        $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
-        $path = Storage::disk('uploads')->path('Departments');
+        try {
+            $zip_file=Storage::disk('uploads')->path('Departments.zip');
+            $zip = new \ZipArchive();
+            $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
+            $path = Storage::disk('uploads')->path('Departments');
 
-        try {
             $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
             foreach ($files as $file) {
@@ -149,12 +149,11 @@
     public function downloadDepartment($id)
     {
-        $department = Department::find($id);
+        try {
+            $department = Department::find($id);
+            $zip_file=Storage::disk('uploads')->path('Department.zip');
+            $zip = new \ZipArchive();
+            $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
+            $path = Storage::disk('uploads')->path($department->location);
 
-        $zip_file=Storage::disk('uploads')->path('Department.zip');
-        $zip = new \ZipArchive();
-        $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
-        $path = Storage::disk('uploads')->path($department->location);
-
-        try {
             $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
             foreach ($files as $file) {
Index: app/Http/Controllers/Dashboard/FoldersController.php
===================================================================
--- app/Http/Controllers/Dashboard/FoldersController.php	(revision 94f05dcdae6255fd3aa74c6925f9286ee591bb91)
+++ app/Http/Controllers/Dashboard/FoldersController.php	(revision df6e9ecdf8595d3dfec8137afae9a415164b1717)
@@ -276,13 +276,13 @@
     public function downloadfolder(Request $request, $id)
     {
-        $folder = Folder::find($id);
-
-        $FileSystem = new Filesystem();
-        $zip_file = Storage::disk('uploads')->path('Folder.zip');
-        $zip = new \ZipArchive();
-        $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
-        $path = Storage::disk('uploads')->path($folder->department->location . DIRECTORY_SEPARATOR . $folder->name);
-
         try {
+            $folder = Folder::find($id);
+            $FileSystem = new Filesystem();
+            $zip_file = Storage::disk('uploads')->path('Folder.zip');
+            $zip = new \ZipArchive();
+            $zip->open($zip_file, \ZipArchive::CREATE | \ZipArchive::OVERWRITE);
+
+            $path = Storage::disk('uploads')->path($folder->department->location . DIRECTORY_SEPARATOR . $folder->name);
+
             $files = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path));
 
Index: database/factories/FolderFactory.php
===================================================================
--- database/factories/FolderFactory.php	(revision 94f05dcdae6255fd3aa74c6925f9286ee591bb91)
+++ database/factories/FolderFactory.php	(revision df6e9ecdf8595d3dfec8137afae9a415164b1717)
@@ -27,6 +27,8 @@
     public function definition()
     {
+        $inputArray = [5, 15, 25, 35, 45, 55, 65, 75];
+        $deptId = Arr::random($inputArray);
 
-        $deptCode = Department::find(1)->code;
+        $deptCode = Department::find($deptId)->code;
 
         $name = $this->faker->unique()->firstName();
@@ -41,5 +43,5 @@
             'location' => $location,
             'user_id' => 1,
-            'department_id' => 1,
+            'department_id' => $deptId,
             'is_important' => $this->faker->boolean,
             'created_at' => now()
Index: database/seeders/FoldersTableSeeder.php
===================================================================
--- database/seeders/FoldersTableSeeder.php	(revision 94f05dcdae6255fd3aa74c6925f9286ee591bb91)
+++ database/seeders/FoldersTableSeeder.php	(revision df6e9ecdf8595d3dfec8137afae9a415164b1717)
@@ -17,5 +17,5 @@
     public function run()
     {
-        Folder::factory()->count(5)->create();
+        Folder::factory()->count(900)->create();
         $folders = Folder::all();
 
