/**
  * @param array $data
  * @param $id
  * @return array|mixed
  * @throws ValidatorException
  */
 public function update(array $data, $id)
 {
     try {
         $this->validator->with($data)->setId($id)->passesOrFail();
         $this->repository->update($data, $id);
     } catch (ValidatorException $e) {
         return ['error' => true, 'message' => $e->getMessageBag()];
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     try {
         $this->repository->skipPresenter()->find($id)->delete();
     } catch (\Exception $e) {
         return json_encode(["error" => "Record not found!"]);
     }
 }