public static void CreateFinancialReportToFinancialRegister(XElement source, FinancialReport destination) { Guid registerId = new Guid(source.Element("financialRegisterId").Value); FinancialRegister register = DictionaryMapper.Instance.GetFinancialRegister(registerId); destination.Number.NumberSettingId = register.FinancialReportNumberSettingId; destination.FinancialRegisterId = registerId; DocumentMapper mapper = DependencyContainerManager.Container.Get <DocumentMapper>(); bool exists = mapper.CheckReportExistence(registerId); if (!exists) { destination.IsFirstReport = true; destination.InitialBalance = 0; } else { destination.InitialBalance = mapper.CalculateReportInitialBalance(registerId); } }