public async Task<IHttpActionResult> PutPlacementRecord(int id, PlacementRecord placementRecord)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != placementRecord.Id)
            {
                return BadRequest();
            }

       

            try
            {
                using (var transaction = db.Database.BeginTransaction())
                {
                    
                    db.Entry(placementRecord).State = EntityState.Modified;
                    var orgin = db.PlacementRecords.Where(i => i.Id.Equals(id)).AsNoTracking().First();
                    db.Changes.AddRange(Helper.Logger.ChangeRecords<PlacementRecord>(orgin, placementRecord, RequestContext.Principal.Identity.Name));
                    await db.SaveChangesAsync();
                    transaction.Commit();
                }
               
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlacementRecordExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
        public async Task<IHttpActionResult> PostPlacementRecord(PlacementRecord placementRecord)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            using (var transaction = db.Database.BeginTransaction())
            {
                var Residents = placementRecord.Residents;
                placementRecord.Residents = null;
                db.PlacementRecords.Add(placementRecord);
                await db.SaveChangesAsync();
                foreach (var r in Residents)
                {
                    if (r.PlacementRecordId != null)
                    {
                        transaction.Rollback();
                        return StatusCode(HttpStatusCode.Conflict);
                    }
                    r.PlacementRecordId = placementRecord.Id;
                    db.Entry<Resident>(r).State = EntityState.Modified;

                }

                await db.SaveChangesAsync();
                db.Changes.Add(Helper.Logger.NewRecord<PlacementRecord>(placementRecord,RequestContext.Principal.Identity.Name));
                await db.SaveChangesAsync();
                transaction.Commit();
            }

            return CreatedAtRoute("DefaultApi", new { id = placementRecord.Id }, placementRecord);
        }