Resource and providers

Would be good to move the error check into the libraries. Call the method from each provider, since we are doing the same error check in every provider.