'calle', 'number' => 'numero', 'comuna_id' => 'comuna', ]; foreach ($data as $key => $value) { if (array_key_exists($key, $dataMap)) { $data[$dataMap[$key]] = $value; unset($data[$key]); } } try { return $this->direccionRepository->fetchByCalleAndNumeroAndExtraAndComuna($data['calle'], $data['numero'], $data['extra'], $data['comuna']); } catch (Implement\Exception\EmptyResult) { $filteredData = $this->direccionRepository->filterData($data); $direccion = $this->direccionRepository->create($filteredData); try { return $this->direccionRepository->save($direccion); } catch (PDOException $exception) { throw new ServiceAction\Create(__CLASS__, $exception); } } } }