Refactor resource declaration context.