Refactoring provider crashes - C#