bool CheckIfExists(SqlConnection connection, SurvelemOld e)
        {
            var r = connection.Query(
                "SELECT COUNT(ID) as Count FROM Survelems WHERE NetmeraId = @id", new { id = e.id }).ToList().First();

            return(r.Count > 0);
        }
        void Insert(SurvelemOld e, SqlConnection connection)
        {
            var newId = Guid.NewGuid();

            Guid?optionId  = null;
            Guid?optionId2 = null;

            if (!string.IsNullOrEmpty(e.OptionID))
            {
                optionId = _options.First(x => x.NetmeraId == e.OptionID).Id;
            }

            if (!string.IsNullOrEmpty(e.OptionID2ndry))
            {
                optionId2 = _options.First(x => x.NetmeraId == e.OptionID2ndry).Id;
            }

            connection.Execute(@"INSERT INTO [dbo].[Survelems]
           ([Id]
           ,[OptionID]
           ,[UPRN]
           ,[Question_Ref]
           ,[COMMENT]
           ,[Freetext]
           ,[BuildingType]
           ,[DateOfSurvey]
           ,[CustomerID]
           ,[CustomerSurveyID]
           ,[NetmeraId]
           ,[CreateDate]
           ,[OptionID2ndry]
            ,SqT1 
           ,SqT2
           ,SqT3 
           ,SqT4 
           ,SqT5 
           ,SqT6 
           ,SqT7 
           ,SqT8 
           ,SqT9 
           ,SqT10 
           ,SqT11
           ,SqT12 
           ,SqT13
           ,SqT14 
           ,SqT15 

           ,SqN1 
           ,SqN2
           ,SqN3 
           ,SqN4 
           ,SqN5 
           ,SqN6 
           ,SqN7 
           ,SqN8 
           ,SqN9 
           ,SqN10 
           ,SqN11
           ,SqN12 
           ,SqN13
           ,SqN14 
           ,SqN15 

)
     VALUES
           (@Id
           ,@OptionID
           ,@UPRN
           ,@Question_Ref
           ,@COMMENT
           ,@Freetext
           ,@BuildingType
           ,@DateOfSurvey
           ,@CustomerID
           ,@CustomerSurveyID
           ,@NetmeraId
           ,@CreateDate
           ,@OptionID2ndry

           ,@SqT1 
           ,@SqT2
           ,@SqT3 
           ,@SqT4 
           ,@SqT5 
           ,@SqT6 
           ,@SqT7 
           ,@SqT8 
           ,@SqT9 
           ,@SqT10 
           ,@SqT11
           ,@SqT12 
           ,@SqT13
           ,@SqT14 
           ,@SqT15 

           ,@SqN1 
           ,@SqN2
           ,@SqN3 
           ,@SqN4 
           ,@SqN5 
           ,@SqN6 
           ,@SqN7 
           ,@SqN8 
           ,@SqN9 
           ,@SqN10 
           ,@SqN11
           ,@SqN12 
           ,@SqN13
           ,@SqN14 
           ,@SqN15 


)", new
            {
                @Id              = newId,
                OptionID         = optionId,
                UPRN             = e.UPRN,
                Question_Ref     = e.Question_Ref,
                COMMENT          = e.COMMENT,
                Freetext         = e.Freetext,
                BuildingType     = e.BuildingType,
                DateOfSurvey     = e.DateOfSurvey,
                CustomerID       = e.CustomerID,
                CustomerSurveyID = e.CustomerSurveyID,
                NetmeraId        = e.id,
                CreateDate       = DateTime.UtcNow,
                OptionID2ndry    = optionId2,
                e.SqT1,
                e.SqT2,
                e.SqT3,
                e.SqT4,
                e.SqT5,
                e.SqT6,
                e.SqT7,
                e.SqT8,
                e.SqT9,
                e.SqT10,
                e.SqT11,
                e.SqT12,
                e.SqT13,
                e.SqT14,
                e.SqT15,

                e.SqN1,
                e.SqN2,
                e.SqN3,
                e.SqN4,
                e.SqN5,
                e.SqN6,
                e.SqN7,
                e.SqN8,
                e.SqN9,
                e.SqN10,
                e.SqN11,
                e.SqN12,
                e.SqN13,
                e.SqN14,
                e.SqN15,
            });
        }