Refactor unreserve stock function.