Could you please extract this code into separate method.  To remove code duplication and make this code more readable.