public static function compact(array $array, bool $treatNullAsTrue = false)
    {
        $compacted = array();
        foreach ($array as $key => $field) {
            if (true === $treatNullAsTrue) {
                if ($field || null === $field) {
                    $compacted[$key] = $field;
                }
            } else {
                if ($field) {
                    $compacted[$key] = $field;
                }
            }
        }

        return $compacted;
    }