MP2-431 Invalid SQL built when counting media item - Add a guard so it only appends ", " if groupClause is not empty - Call Convert.ToInt32 on the result of ExecuteScalar (it returns Int64 on my system so the cast to int fails)