protected function checkTransaction(array $context)
    {
        if (!in_array($context['action'], $this->allowed)) {
            throw new \UnexpectedValueException("Invalid action '{$context['action']}' specified for changelog (must be one of [ " . implode(', ', $this->allowed) . ' ])');
        }
        if (empty($context['old']) && empty($context['new'])) {
            throw new \UnexpectedValueException('Tried to log something that cannot be: both old and new content are empty');
        }
        if (empty($context['old']) && in_array($context['action'], ['UPDATE', 'DELETE'])) {
            throw new \UnexpectedValueException("Cannot log action '{$context['action']}' when old content doesn't exist");
        }
        if (empty($context['new']) && in_array($context['action'], ['INSERT', 'UPDATE'])) {
            throw new \UnexpectedValueException("Cannot log action '{$context['action']}' when new content is empty");
        }
    }