/**
  * @param $componentDto PageComponentDto
  * @param bool $nullable
  * @return Entity
  * @throws AemosRestException
  */
 public static function filter(PageComponentDto $componentDto, $nullable = false)
 {
     foreach (PageComponentType::getTypes() as $type) {
         if ($componentDto->getType() == $type) {
             $componentClass = "Component" . ucfirst($type);
             return ArrayHelper::mapDataToObject($componentDto->getComponent(), new $componentClass());
         }
     }
     if (!$nullable) {
         throw new AemosRestException(AppLabelUtil::$ERROR_COMPONENT_UNKNOWN, HttpStatusCode::badRequest());
     }
     return null;
 }