protected function convertValue($value)
    {
        switch ($this->propertyType->getDataTypeId()) {
            case PropertyType::DATATYPE_BOOLEAN:
                return (bool) $value;
                break;
            case PropertyType::DATATYPE_DATETIME:
                if ($value instanceof \DateTime) {
                    return $value;
                }
                    try {
                        return new \DateTime($value);
                    } catch (\Exception $e) {
                        return null;
                    }

                break;
            case PropertyType::DATATYPE_FLOAT:
                return (float) $value;
                break;
            case PropertyType::DATATYPE_INTEGER:
                return (int) $value;
                break;
            case PropertyType::DATATYPE_STRING:
                return (string) $value;
                break;
            default:
                return $value;
                break;
        }
    }