/**
  * Sweet baby jesus hashtag2
  *
  * @param                     $userId
  * @param                     $blueprintId
  * @param PathBuilder         $pathBuilder
  * @param Blueprint           $blueprintModel
  * @param BlueprintCollection $blueprintCollection
  * @param Filesystem          $file
  * @param Repository          $repository
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postDeleteBlueprint($userId, $blueprintId, PathBuilder $pathBuilder, Blueprint $blueprintModel, BlueprintCollection $blueprintCollection, Filesystem $file, Repository $repository)
 {
     $blueprint = $blueprintModel->where(['id' => $blueprintId])->first()->toArray();
     $blueprintScreenshootRequired = $pathBuilder->create()->fromPublicPath($repository->get('blueprint.paths.storage.buildcraft.images')) . $blueprint['screenshot'];
     // append the archive name name to the default storage path
     $blueprintArchive = $pathBuilder->create()->fromPublicPath($repository->get('blueprint.paths.storage.buildcraft.archives')) . $blueprint['archive_name'];
     // append the screenshoot name to the default storage path
     if ($file->exists($blueprintScreenshootRequired)) {
         $file->delete($blueprintScreenshootRequired);
     }
     if ($file->exists($blueprintArchive)) {
         $file->delete($blueprintArchive);
     }
     if (null !== $blueprint['screenshot_optional_0']) {
         $blueprintScreenshootOptiona_0 = $pathBuilder->create()->fromPublicPath($repository->get('blueprint.paths.storage.buildcraft.images')) . $blueprint['screenshot_optional_0'];
         // append the screenshoot name to the default storage path
         if ($file->exists($blueprintScreenshootOptiona_0)) {
             $file->delete($blueprintScreenshootOptiona_0);
         }
     }
     if (null !== $blueprint['screenshot_optional_1']) {
         $blueprintScreenshootOptiona_1 = $pathBuilder->create()->fromPublicPath($repository->get('blueprint.paths.storage.buildcraft.images')) . $blueprint['screenshot_optional_1'];
         // append the screenshoot name to the default storage path
         if ($file->exists($blueprintScreenshootOptiona_1)) {
             $file->delete($blueprintScreenshootOptiona_1);
         }
     }
     // Delete any association of this blueprint with any collection
     $blueprintCollection->where(['blueprint_id' => $blueprintId])->delete();
     if ($blueprintModel->destroy($blueprintId)) {
         return redirect()->route('buildcraft::user::uploads', ['user_id' => $userId])->with('blueprintDeleteSuccess', true);
     }
     return redirect()->route('buildcraft::user::uploads', ['user_id' => $userId])->with('blueprintDeleteSuccess', false);
 }