I am really new in vb.net programming language so im using visual studio 2012 LightSwitch to make some simple stock management system.

I have a problem with controlling stock quantity after make a sales order. I am using this code on server side:

Namespace LightSwitchApplication

    Public Class ApplicationDataService

        Private Sub OrderDetails_Inserted(entity As OrderDetail)

            For Each orddetail As OrderDetail In Me.OrderDetails
                 Dim currentproduct =  Me.DataWorkspace.ApplicationData.Parts.Where(Function(o) o.Id =  orddetail.Part.Id).FirstOrDefault()
                If currentproduct IsNot Nothing Then
                    currentproduct.Quantity = (currentproduct.Quantity - orddetail.Quantity)
                    Throw New Exception("Not enough quantity")
                End If

        End Sub

    End Class

End Namespace
And i get this error:

Unable to save data. Non-static method requires a target.

Might i mention, if i put the code to client side to execute after order is inserted to save, it kind of works but i cant control insert, update, delete events... Or am i wrong?

Thank you for your help!