public async Task <CompanyModel> AddCompanyAsync(CompanyModel model, ICollection <ImagePickerResult> docs) { long id = model.CompanyID; using (var dataService = DataServiceFactory.CreateDataService()) { var company = new Company(); if (company != null) { if (docs != null && docs.Count > 0) { List <CompanyDocuments> docList = new List <CompanyDocuments>(); foreach (var obj in docs) { var doc = new CompanyDocuments(); UpdateDocumentFromModel(doc, obj); docList.Add(doc); } company.CompanyDocuments = docList; } UpdateCompanyFromModel(company, model); company.CompanyGuid = Guid.NewGuid(); await dataService.UpdateCompanyAsync(company); model.Merge(await GetCompanyAsync(dataService, company.CompanyID)); } return(model); } }