public PageModel SaveAs(dynamic item, string newId)
{
Assert.IsTrue(item != null);
var oldId = item.Id as string;
Value = item;
Value.Id = newId;
Validate();
if (HasError) return this;
if (oldId != newId)
{
if (Repository.Exists(newId))
{
Errors.Add("Id", string.Format("{0} exisits already.", Value.Id));
}
else
{
Repository.Delete(oldId);
}
}
if (!HasError) Value.Id = Repository.Save(Value.Id as string, Value);
return this;
}