public static void CopyProperties(DatabaseBackedObject copyFrom, DatabaseBackedObject copyTo)
        {
            Type dboType = copyFrom.GetType().BaseType;

            if (copyTo.GetType().BaseType != dboType &&
                copyTo.GetType() != dboType)
            {
                Console.Error.WriteLine("Dbo types do not match!");
                return;
            }

            PropertyInfo[] properties = dboType.GetProperties();

            foreach (PropertyInfo prop in properties)
            {
                if (prop.SetMethod != null)
                {
                    object fromVal = prop.GetValue(copyFrom);
                    prop.SetValue(copyTo, fromVal);
                }
            }
        }
        public virtual List <Change> GetChanges(DatabaseBackedObject beforeObject)
        {
            // TODO: Load user id from current session
            // TODO: Add changes automatically, using long names from db + "Changed" e.g 'as_usid Changed'

            List <Change> output = new List <Change>();
            int           UserId = 0;


            if (ID != beforeObject.ID)
            {
                output.Add(new Change()
                {
                    ch_datetime    = DateTime.Now,
                    ch_field       = "ID",
                    ch_oldvalue    = beforeObject.ID.ToString(),
                    ch_newvalue    = ID.ToString(),
                    ch_description = "ID Changed",
                    ch_recid       = ID,
                    ch_usid        = UserId
                });
            }
            if (Name != beforeObject.Name)
            {
                output.Add(new Change()
                {
                    ch_datetime    = DateTime.Now,
                    ch_field       = "Name",
                    ch_oldvalue    = beforeObject.Name,
                    ch_newvalue    = Name,
                    ch_description = "Name Changed",
                    ch_recid       = ID,
                    ch_usid        = UserId
                });
            }

            return(output);
        }