public static bool Insert(DTOs.CustomerDTO customer) { List <Models.Entity.Profile> db = GetData(); Models.Entity.Profile newCustomer = customer.Map(); Models.Civil.Document cpf = (from document in newCustomer.Documents where document.Name.ToLower() == "cpf" select document).FirstOrDefault(); if (cpf != null) { Models.Entity.Profile existingUser = (from profile in db from document in profile.Documents where document.Name.ToLower() == "cpf" && document.Value == cpf.Value select profile).FirstOrDefault(); if (existingUser != null) { return(false); } } newCustomer.NewId(); db.Add(newCustomer); UpdateData(db); return(true); }