Programmatically move points in a CustomCurveObject

I made a derived class from CustomCurveObject like this:

public class BeamObject : CustomCurveObject
{
        public Point3d PointAtStart => CurveGeometry.PointAtStart;

        public Point3d PointAtEnd => CurveGeometry.PointAtEnd;

        public BeamObject()
            : base()
        {            
        }

        public BeamObject(Point3d from, Point3d to)
            : base(new LineCurve(from, to))
        {
        }

        public BeamObject(Line line)
            : base(new LineCurve(line))
        {
        }
...
}

I need to modify the Start and/or End point when another Object changes so I created a handler like this:

private void RhinoDoc_BeforeTransformObjects(object sender, Rhino.DocObjects.RhinoTransformObjectsEventArgs e)
{
    ...
    Rhino.Geometry.Point3d newPointAtStart = ...;
    Rhino.Geometry.Point3d newPointAtEnd = ...;

     doc.Objects.Replace(beam.Id, new Rhino.Geometry.LineCurve(pointAtStart, pointAtEnd));

      doc.Views.Redraw();
}

Unfortunately it doesn’t work. I tried also to call the CustomCurveObject.SetCurve() or to change the CustomCurveObject.CurveGeometry.PointAtStrart/PointAtEnd properties but nothing changes.

Can anyone please help me?
Thanks in advance
Giorgio