// POST odata/ElementCell
        public virtual async Task<IHttpActionResult> Post(ElementCell elementCell)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            try
            {
                await MainUnitOfWork.InsertAsync(elementCell);
            }
            catch (DbUpdateException)
            {
                if (MainUnitOfWork.Exists(elementCell.Id))
                {
                    return Conflict();
                }
                else
                {
                    throw;
                }
            }

            return Created(elementCell);
        }
        // PUT odata/ElementCell(5)
        public virtual async Task<IHttpActionResult> Put([FromODataUri] int key, ElementCell elementCell)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (key != elementCell.Id)
            {
                return BadRequest();
            }

            try
            {
                await MainUnitOfWork.UpdateAsync(elementCell);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MainUnitOfWork.Exists(key))
                {
                    return NotFound();
                }
                else
                {
                    return Conflict();
                }
            }

            return Ok(elementCell);
        }
        //public UserElementCell(User user, ElementCell elementCell, decimal rating)
        //public UserElementCell(User user, ElementCell elementCell) : this()
        public UserElementCell(ElementCell elementCell) : this()
        {
            //Validations.ArgumentNullOrDefault(user, "user");
            Validations.ArgumentNullOrDefault(elementCell, "elementCell");

            //User = user;
            ElementCell = elementCell;
            //Rating = rating;
        }
        public ElementCell AddCell(ElementField field)
        {
            Validations.ArgumentNullOrDefault(field, "field");

            if (ElementCellSet.Any(item => item.ElementField == field))
                throw new Exception("An element item can't have more than one cell for the same field.");

            var cell = new ElementCell(field, this);
            field.ElementCellSet.Add(cell);
            ElementCellSet.Add(cell);
            return cell;
        }
        public ElementCell AddCell(ElementField field)
        {
            Validations.ArgumentNullOrDefault(field, "field");

            if (ElementCellSet.Any(item => item.ElementField == field))
            {
                throw new Exception("An element item can't have more than one cell for the same field.");
            }

            var cell = new ElementCell(field, this);

            field.ElementCellSet.Add(cell);
            ElementCellSet.Add(cell);
            return(cell);
        }
        public UserElementCell(ElementCell elementCell) : this()
        {
            Validations.ArgumentNullOrDefault(elementCell, "elementCell");

            ElementCell = elementCell;
        }