if (model.SalesOrderHeaderId != null)

            {
                entity.SalesOrderHeaderId = model.SalesOrderHeaderId;
            }