Take deserialization outside the methods as it can be reused.

Adding TryCast method improves readability and decreases the code nesting.