/**
  * Update the specified resource in storage.
  *
  * @param  \App\Http\Request\ApplicationFormRequest $request
  * @param  string  $id
  * @return Response
  */
 public function update(ApplicationFormRequest $request, $id)
 {
     try {
         $app = Application::getByIdForUser($id, $this->user);
     } catch (ModelNotFoundException $e) {
         session()->flash('error', 'Sorry, you cannot update the application.');
         return redirect()->route('application');
     }
     $app->fill($request->only('name', 'description', 'type'));
     if ($app->save()) {
         session()->flash('success', 'Application is successfully updated.');
         return redirect()->route('application');
     }
     session()->flash('error', 'Error occured to update your application.');
     return back()->withInput();
 }