Consider refactoring this method out into smaller methods as the `return` nested two `if`s could lead to confusion, perhaps something like;

```
def _updateFilterWithData(layer, name, newFilterData) {
    def filter = getFilterByLayerName(layer, name, newFilterData)
    if (filter) {
        // Update possibleValues
        filter.possibleValues = filter.type.expectsPossibleValues ? _trimFilterPossibleValues(newFilterData) : []
    }

    return filter
}

def getFilterByLayerName(layer, name, newFilterData) {
    return Filter.findByLayerAndName(layer, name) || getFilterByType(layer, name, newFilterData)
}

def getFilterByType(layer, name, newFilterData) {
    def filter
    def filterType = FilterType.typeFromString(newFilterData.type)

    if (filterType) {
        filter = new Filter(name: newFilterData.name, layer: layer, label: newFilterData.name)
        filter.type = filterType
    }

    return filter
}
```