Fix StyleCop and ReSharper warnings