protected function checkEnum($entity, $schema, $entityName)
    {
        $valid = true;
        if (isset($schema->enum) && $schema->enum) {
            if (!is_array($schema->enum)) {
                throw new SchemaException(sprintf('Enum property must be an array for [%s]', $entityName));
            }
            if (is_array($entity)) {
                foreach ($entity as $val) {
                    if (!in_array($val, $schema->enum)) {
                        $valid = false;
                    }
                }
            } else {
                if (!in_array($entity, $schema->enum)) {
                    $valid = false;
                }
            }
        }

        if (!$valid) {
            throw new ValidationException(sprintf('Invalid value(s) for [%s], allowable values are [%s]', $entityName, implode(',', $schema->enum)));
        }

        return $this;
    }