Added logic to save patient, studies and series to XML