/**
  * Adds one or many data entries for person with given $id
  * Expects JSON data with below structure
  *
  * [
  *     {"type": "custom", "label": "a label nr 1", "value": "a value1"},
  *     {"type": "custom", "label": "a label nr 2", "value": "a value2"},
  *     {"type": "custom", "label": "a label nr 3", "value": "a value3"}
  * ]
  *
  * @param string $id
  * @return Response
  */
 public function apiPostAction($id)
 {
     $person = $this->personRepository->find(PersonId::fromString($id));
     if (!$person) {
         abort(404);
     }
     $newData = Input::get();
     foreach ($newData as $dataRow) {
         $person->addData(DataType::fromString($dataRow['type']), $dataRow['label'], $dataRow['value']);
     }
     $this->personRepository->update($person);
     return response()->json($person);
 }
 /**
  * @param Request $request
  * @return Response
  */
 public function postAction(Request $request)
 {
     $person = new Person(PersonId::generate(), $request->request->get('name'));
     $this->personRepository->add($person);
     return response()->json($person);
 }
 /**
  * @param string $id
  * @return Response
  */
 public function dashboard($id)
 {
     $person = $this->personRepository->find(PersonId::fromString($id));
     return response()->json($person);
 }