/**
  * @return Collection
  */
 private function getAttachments() : Collection
 {
     $attachments = $this->repository->get();
     return $attachments;
 }
 /**
  * @param AttachmentFormRequest         $request
  * @param AttachmentRepositoryInterface $repository
  * @param Attachment                    $attachment
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(AttachmentFormRequest $request, AttachmentRepositoryInterface $repository, Attachment $attachment)
 {
     $attachmentData = ['title' => $request->input('title'), 'description' => $request->input('description'), 'notes' => $request->input('notes')];
     $repository->update($attachment, $attachmentData);
     Session::flash('success', strval(trans('firefly.attachment_updated', ['name' => $attachment->filename])));
     Preferences::mark();
     if (intval(Input::get('return_to_edit')) === 1) {
         // set value so edit routine will not overwrite URL:
         Session::put('attachments.edit.fromUpdate', true);
         return redirect(route('attachments.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]);
     }
     // redirect to previous URL.
     return redirect(session('attachments.edit.url'));
 }