private static void SyncUdfs()
        {
            List<ADDITIONALFIELD> lstaf = new List<ADDITIONALFIELD>();
            ADDITIONALFIELD af = new ADDITIONALFIELD();
            af.LENGTH = "65536";
            af.NAME = "ECM Application:RAM_Application_Number";
            lstaf.Add(af);

            af.LENGTH = "65536";
            af.NAME = "ECM Application:RAM_Application_Number1";
            lstaf.Add(af);


            //MySerializableClass myObject;
            // Construct an instance of the XmlSerializer with the type
            // of object that is being deserialized.

            XmlSerializer mySerializer = new XmlSerializer(typeof(List<ADDITIONALFIELD>));
            // To read the file, create a FileStream.

            //TextWriter textWriter = new StreamWriter(@"D:\Users\WyldLynx\Documents\ECMTEST.xml");

            //mySerializer.Serialize(textWriter, lstaf);
            //textWriter.Close();


            //
            FileStream myFileStream = new FileStream(@"\ECMTEST.xml", FileMode.Open);
            // Call the Deserialize method and cast to the object type.
            lstaf = (List<ADDITIONALFIELD>)mySerializer.Deserialize(myFileStream);

            TrimApplication.Initialize();
            using (Database db = new Database())
            {
                foreach (ADDITIONALFIELD aff in lstaf)
                {
                    if (db.FindTrimObjectByName(BaseObjectTypes.FieldDefinition, aff.NAME) == null)
                    {
                        FieldDefinition fd = new FieldDefinition(db);
                        fd.Name = aff.NAME;


                        switch (Convert.ToInt64(aff.FORMAT))
                        {
                            case 0:
                                fd.Format = UserFieldFormats.String;
                                break;
                            case 1:
                                fd.Format = UserFieldFormats.Number;
                                break;
                            case 2:
                                fd.Format = UserFieldFormats.Boolean;
                                break;
                            case 3:
                                fd.Format = UserFieldFormats.Date;
                                break;
                            case 4:
                                fd.Format = UserFieldFormats.Datetime;
                                break;
                            case 5:
                                fd.Format = UserFieldFormats.Decimal;
                                break;
                            case 6:
                                fd.Format = UserFieldFormats.Text;
                                break;
                            case 7:
                                fd.Format = UserFieldFormats.Currency;
                                break;
                            //case 8:
                            //    fd.Format = UserFieldFormats.
                            //    break;
                            case 9:
                                fd.Format = UserFieldFormats.Object;
                                break;
                            //case 10:
                            //    fd.Format = UserFieldFormats.
                            //    break;
                            case 11:
                                fd.Format = UserFieldFormats.String;
                                break;

                            case 13:
                                fd.Format = UserFieldFormats.Geography;
                                break;
                        }
                        fd.UpperLimit = aff.UPPERLIMIT;
                        fd.Length = Convert.ToInt32(aff.LENGTH);
                        fd.SetNotes("Additional field syncronised automatically", NotesUpdateType.AppendWithUserStamp);
                        RecordType rt = new RecordType(db, 16);
                        fd.SetIsUsedForRecord(rt, true);
                        fd.Save();
                        
                        Console.WriteLine("new additional field added: " + fd.Name);

                    }
                    else
                    {
                        Console.WriteLine("Additional field already exists: " + aff.NAME);
                    }

                }

            }
        }