updated firstOrCreate and SingleOrCreate methods to fix performance bug