Thank you for using Sitefinity!
Does the error reproduce when you execute the code while logged in as admin (or a user that can make modifications to the module items)?
If you want to run your logic with authentication you should place it in a method, which you can pass to the SystemManager.RunWithElevatedPrivilege(), as a delegate, so that you can authenticate yourself.
Another thing you could try is to run it in elevated mode like so:
//your logic here
You can also suppress the security checks before making the changes like so:
After the SaveChanges do not forget to set it back to false.
Try those and if you ran into some problems, please don't hesitate to contact us.
Ivan A. Petrov
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking
system and vote to affect the priority of the items