protected function processModel($objData, callable $before = null, callable $after = null)
    {
        if ($this->dynamicTypeField && isset($objData[$this->dynamicTypeField])) {
            $objType = $objData[$this->dynamicTypeField];
        } else {
            $objType = get_class($this->model());
        }

        $obj = $this->factory()->create($objType);

        if ($before !== null) {
            call_user_func_array($before, [ &$obj ]);
        }

        $obj->setFlatData($objData);

        if ($after !== null) {
            call_user_func_array($after, [ &$obj ]);
        }

        return $obj;
    }