protected function checkRequiredAttributes($data)
    {
        $existingAttributes = array_keys($data);
        $errors = array();
        foreach ($this->requiredAttributes as $requiredAttribute) {
            if (!in_array($requiredAttribute, $existingAttributes)
                || $data[$requiredAttribute] === ''
                || $data[$requiredAttribute] === null
            ) {
                $errors[] = $requiredAttribute.' is missing or empty';
            }
        }

        if (count($errors) > 0) {
            throw new ValidationError('Missing required fields', $errors);
        }

        return true;
    }