So looks like seemingly easy things in Acumatica are terribly complicated to implement. All I wanna do is to copy last row of my grid as a new one. I would like the user to persist the changes himself, so my code would put it just in cache. This is my action so far:

```
    public PXAction<SOOrder> copyLastRow;
    [PXUIField(DisplayName = "Copy Last Row", MapEnableRights = PXCacheRights.Select, MapViewRights = PXCacheRights.Select)]
    [PXLookupButton]
    public virtual IEnumerable CopyLastRow(PXAdapter adapter)
    {
        SOLine line = Base.Transactions.Select().LastOrDefault();
        int? lineNbr = 0;

        foreach(SOLine line2 in Base.Transactions.Select())            
            if (line2.LineNbr > lineNbr)
                lineNbr = line2.LineNbr;

        line.LineNbr = lineNbr + 1;
        Base.Transactions.Cache.Insert(line);           

        return adapter.Get();
    }

```

So maybe I am not getting something or completely wrong in my code, but I'm getting errors no matter what I do. The grid is not getting refreshed with my row and I keep getting all sorts of errors, such as "This record cannot be saved" or "another process updated this record", etc. Also, any ideas on how to generate a new lineNbr without clunky logic I have? Much appreciated if anyone can help.