But only one will ever be executed :thinking:     If the condition in L60 is true, it will only execute the first one and then return. IMHO there's no need to put them both in one db session.    (Unless you mean the function itself should be executed in the same session as the caller one is currently in, but that's a whole different story.)