update resource@save logic and fixed the test