protected function convertDbResultToAcumulusEntries($result, $ignoreLock = true)
    {
        if (empty($result)) {
            $result = null;
        } elseif (is_object($result)) {
            $result = $this->container->getAcumulusEntry($result);
            if ($ignoreLock && $result->isSendLock()) {
                $result = null;
            }
        } else {
            // It's a non empty array of results.
            foreach ($result as &$record) {
                $record = $this->container->getAcumulusEntry($record);
                if ($ignoreLock && $record->isSendLock()) {
                    $record = null;
                }
            }
            array_filter($result);
            if (empty($result)) {
                $result = null;
            } elseif (count($result) === 1) {
                $result = reset($result);
            }
        }
        return $result;
    }