public static function getValue($owningEntity, $key)
    {
        $entity = $owningEntity->getNonemptyCustomFields()->get($key);

        if ($entity) {
            $value = $entity->getValue();
        } else {
            self::checkCustomFieldExists($owningEntity, $key);
            $value = null;
        }

        return $value;
    }